Git Product home page Git Product logo

Comments (5)

AqlaSolutions avatar AqlaSolutions commented on August 15, 2024

Hmm.. or may be it's because we previously generated navmesh right in the app and the model was loaded with our "correct-handed" axis. But now the model is loaded in the "Examples" project, serialized there and deserialized on our side.

from sharpnav.

Robmaister avatar Robmaister commented on August 15, 2024

SharpNav assumes left-handed (Y up). Nothing should have changed on our end. It's almost definitely because you serialized in one coordinate system (Examples) and deserialized in the other (your program). For the sake of simplicity, I'm going to say that you should assume that coordinate space for all SharpNav files.

Also the generation process is dependent on that same coordinate system, so I'm really not sure how you'd be generating a mesh in a right handed space and be getting any decent result out...

from sharpnav.

AqlaSolutions avatar AqlaSolutions commented on August 15, 2024

So are you going to provide any setting to toggle this or should I make a wrapper around NavMeshQuery on our side?

Y-up is everywhere but left/right-handed is different between DirectX and OpenGL.

from sharpnav.

AqlaSolutions avatar AqlaSolutions commented on August 15, 2024

Sorry for being a bit misleading, looks like I have to tell you the full story)

  1. Initially the model is saved in 3DsMax.
  2. SharpNav library just treats the coordinates as they are, so no difference for left/right handed.
  3. In your Examples app those coordinates are used to render the model and navmesh (everything is fine here).
  4. On our side we need to deal with another-handed axis because Unity3D uses it. So we load the model with inverted X axis and the order of vertices.
  5. Previously we used that model to generate NavMesh that we need but now we generate everything in Examples app and the model is not inverted there.
  6. If we change the loader on Examples app side it will generate correct (for our app) navmesh but the renderer will show the model mirrored.

So we need to generate NavMesh in one-handed system, then open it in our app where we need it another-handed.

Can you help us to decide how we can deal with this situation with SharpNav beside maintaining a wrapper of NavMeshQuery on our side (and I'm not sure whether it will work)?

from sharpnav.

Robmaister avatar Robmaister commented on August 15, 2024

Looks like I got my terminology mixed up for a second there. Unity and SharpNav both use a right handed coordinate system (Y up/X right/Z forward) as opposed to the left handed coordinate system (Y up/X right/Z backwards) and there are Z up variants of both.

Regardless, the reason why your X axis is negative is because you're generating the navmesh before flipping the X axis in Unity, while every other system in Unity works on the model after you flip the X axis (including genrating the navmesh as you used to do). If you flip the X axis in 3ds Max instead of Unity, this problem will go away.

So the solution is to fix whatever underlying reason you have for flipping the model on the X axis in Unity.

If you don't want to do that, consider modifying Examples (or writing your own importer/exporter based off Examples) that transforms all of your input geometry to flip the X axis through an IEnumerable<Triangle3> with some of these helper functions: https://github.com/Robmaister/SharpNav/blob/master/Source/SharpNav/Geometry/TriangleEnumerable.cs

from sharpnav.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.