Comments (5)
The navigation portion of SharpNav is not written yet. Once it is, the navmesh will have an associated bounding volume tree that will make it very fast to do something like this.
At the moment, you could iterate over every polygon in a NavMesh, see if the XZ point is contained in the triangle, then compare it with the Y distance of the last triangle you tested that contained the point. This will be fairly slow, but it'll get the job done for now.
I'm starting to write some code to visualize a NavMesh/NavMeshDetail, so I can't say for sure that you're going to be given proper data from a NavMesh right now.
I'll leave this issue open until I start on the navigation portion and can provide some sample code for doing this.
from sharpnav.
I'll explain what the use-case is:
When the game-server loads, it loads twice - the meshes and the navigation mesh, headless where FPS = 0.
The game server has to check whether or not the move is valid or not.
X not being the min and max width of the terrain,
Y not being the height of the terrain
Z not being the min and max of the terrain.
X Z is easy to get because those are parameters from the origin X, Z of the terrain loaded and the min, max returned by the mesh.
The Y axis is a bit troublesome because it is on the mesh itself.
It would be something like a probe or function where input is X, Z, return a valid Y position. If Y = INF, then that position is NOT walkable.
There would also be function:
where input is X, return TRUE or FALSE, where FALSE = position is not walkable. Or exceeds the mesh boundary.
Example:
-5, 0, 0, returns false
5, 0, 0 returns true.
assuming the mesh loads into positive 0,0 space and where the mesh is 0-100, 0-5, 0-100.
from sharpnav.
It's not part of the navigation codes.
Here is the second use-case:
I had some difficulties last week, so I converted from Collada to Wavefront OBJ format.
The game server uses 2 meshes - terrain and navigation meshes.
There's a fiddly problem because there is so few, so little reference codes in C# for terrain meshes. There's meshomatic but no way to get the world-space without loading OpenTK.
The terrain is represented thrice - one as a quad tree, terrain and as navigation mesh.
There are more than 3,000 NPCs on the terrain. As the user walks around, the NPCs are made visible or invisible depending on the situation. - that's what the quad tree is for.
Terrain - store the list of Y values so when the NPCs instantiate on the client, the player don't go underground, the NPCs don't go underground or float in the air either :)
When the NPCs instantiates, it stores the X, Z values and gets the terrain data to get the exact Y values.
To check if it is a valid move or note, the player can move to all locations where the mesh is, except where the height is +3, -3 of the previous Y value.
The navigation mesh executes the Recast, Crowd and detour algorithm so the NPCs move around.
from sharpnav.
For use-case 1, the algorithm I described will work, only you would return true if you ever found an overlapping polygon.
For the second use-case, that sounds like you just want to compare the Y values of the start/end points and reject the path if the difference is too high, which is simply checking the difference, unless I'm missing something.
I'd also like to re-iterate that I'm not actually done with the navmesh generation code yet, and anything about interacting with the navmesh I'd consider in the navigation section of the library (much like Detour is the navigation library for Recast-generated meshes). There hasn't been any code written to interact with a NavMesh yet.
from sharpnav.
Update: A large portion of Detour has been ported (though some possible bugs in PolyMeshDetail may hinder you), both use-cases should be possible to do now. The API for doing so is probably going to be somewhat awkward at the moment though. I'm working on refactoring a lot of it right now.
from sharpnav.
Related Issues (20)
- Agents do not move when requested target is on the same polygon HOT 4
- Using SharpNav.SharpDX in conjunction with SharpDX 3.0.1 HOT 4
- FixupCorridor IndexOutOfRangeException HOT 11
- FindRandomPointAroundCircle IndexOutOfRangeException HOT 2
- No nearby polys InvalidOperationException
- Fail to compile against .NET 3.5 HOT 8
- .Obj exported from Unity3D causes System.IndexOutOfRangeException HOT 9
- OpenGL error on Example HOT 10
- .net standard version HOT 2
- ERROR HOT 1
- How to import NavMesh from Unity? HOT 1
- How are SharpNav dealing with Licenses? HOT 3
- CalcSlabEndPoints - Struct by reference needed HOT 1
- Dynamic Obstacle
- Is this library appropriate for my usage? HOT 3
- Mesh generation time. Testing on big meshes. HOT 2
- The "filter" in InitSlicedFindPath
- TiledNavMesh not lining up
- Exception: The provided PolyMesh has no vertices. HOT 1
- MergeCorridorStartMoved does not resize the path HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sharpnav.