Git Product home page Git Product logo

Comments (2)

SetoKaiba avatar SetoKaiba commented on July 16, 2024

What about add integration with Unity3D? The most popular game engine with C# support.

from sharpnav.

Robmaister avatar Robmaister commented on July 16, 2024

Unity3D uses a different naming convention for everything, so my method of cross-engine support fails. I assume regular C# naming conventions are used - for example, that in Vector3, the three components are X, Y, and Z. In Unity, however, they follow a different naming convention, so the components are x, y, and z. Simple namespace substitution won't work here.

If you take a look at the top of a most of the C# files in the project, you'll see this block:

using SharpNav.Geometry;

#if MONOGAME
using Vector3 = Microsoft.Xna.Framework.Vector3;
#elif OPENTK
using Vector3 = OpenTK.Vector3;
#elif SHARPDX
using Vector3 = SharpDX.Vector3;
#endif

(example: https://github.com/Robmaister/SharpNav/blob/master/Source/SharpNav/Heightfield.cs)

If performance weren't a concern (trying to be realtime-ish, so it is), I would try to wrap Unity vectors in some sort of a wrapper class but since there's a lot of vector math, I wouldn't be surprised if SharpNav ran at less than half the speed it does now.

Another option would be a ToUnityVector() function and/or implicit cast in the Standalone Vector3 implementation, but this would still have a fair bit of overhead when you want to do anything with the navmesh from Unity (internally stored in the Standalone Vector3 format) and only be syntax sugar over the same way you'd use SharpNav in Unity with the Standalone build.

To make the Unity version act the same way as other versions (internal storage in the engine Vector format), there would need to be some more complex preprocessor or IL stage manipulation of the program to use the engine Vector format.

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.