anyway to automatically generate off-mesh links?

942 views
Skip to first unread message

Peng Zhang

unread,
May 25, 2014, 11:02:04 PM5/25/14
to recastna...@googlegroups.com
Hi, all,
    my game scene has many jump platforms, and some type of AI can findpath to the nearest of the platforms and jump up and jump down. see my pictures below

    currently I use the off-mesh links provided by recast to allow AI to findpath to the jump platforms.  But there is one problem, the jump platforms in my scene are too many, if the artist changes the scene a little bit, these off-mesh links may be invalid and they will be added manually again, which may be a lot of works. So any way to automatically generate these off-mesh links under some generating rules?
appreciate for any help !

Mikko Mononen

unread,
May 26, 2014, 1:05:58 AM5/26/14
to recastna...@googlegroups.com
Hi,

I don't have plans at this point to add that functionality directly into Recast.


--mikko



--

---
You received this message because you are subscribed to the Google Groups "recastnavigation" group.
To unsubscribe from this group and stop receiving emails from it, send an email to recastnavigati...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Peng Zhang

unread,
May 26, 2014, 4:43:48 AM5/26/14
to recastna...@googlegroups.com
thanks for your slides and code, I built the demo on windows and it's really cool to put the slides inside the demo : )   but it seems you did that using solo mesh, and I did not have much time to deep into the Annotation Builder code to meet my requirements.  but I did a little tricky to make the AI jump down the platform without the off-mesh links, it's not elegant but it's simple and does work (not for general purpose)


because my AI only need to jump down from the platform, so I raycast from start point on that platform to the target point on xz plane, iterate this process around a circle, each time offset the raycast result point a bit by direction, and query if I get a valid navmesh height. then I use this new start point to find way to target. 

Mikko Mononen

unread,
May 26, 2014, 5:23:34 AM5/26/14
to recastna...@googlegroups.com
Hi,

Yeah, the example uses solo mesh for simplicity. Unity has similar functionality for automatically finding offmesh links and we keep few rows of voxel tiles around so that we can use multiple tiles to sample if links are valid. Another option is to use physics to check that the jump does not go through objects.

But the core idea is that:
1) the interesting jump points are at navmesh edges
2) you can cull out a lot potential jump points by first checking if the landing point is on navmesh

Then it depends on you game and pipeline what is the fastest and easiest way to check if the link is obstructed or not. I used voxels since it makes the sampling really fast.

--mikko

Peng Zhang

unread,
May 29, 2014, 4:31:31 AM5/29/14
to recastna...@googlegroups.com
Hi, Mikko,
Sorry to bother you again. I've tried the way you mentioned in this link http://digestingduck.blogspot.fi/2011/07/paris-gameai-conference-2011-slides-and.html . I came up two problems and could you spare some time to guide me a direction to solve it? 
The first problem, because I use multiple tiles so I can't directly use the contours of each tile to do the ground sampling because the tile's boundary is treated as the contours too. what i do now is to build the navmesh first, and find out all navmesh edges(I use the code from function drawPolyBoundaries in DetourDebugDraw.cpp), see my pictures below, the red lines are going to be sampled.


but I don't know if these edges are stored as a specific order (like Clockwise or CCW), which ensures the sampling edge's local axis is the same(Left-handed/Right-handed)
and the second problem, I've checked the Unity's online document and it seems that the jump links are connected precisely on the sampling edges, see my pictures below:

but use the method you provided in your blog, the jump end point may not be exactly on the edge, see the pictures below, I've marked the potential jump links:


If possible could you give me some hint about how you did the ground sampling in Unity? 
thanks in advance!

Mikko Mononen

unread,
May 29, 2014, 5:25:34 AM5/29/14
to recastna...@googlegroups.com
Hi,

You can detect the edges leading to neighbour tiles by checking the fourth component of the contour vertices:

Polygon windings are always consistent.

The Unity sampling does not try to connect the edges precisely, the example just happens to be close to the jump distance.

If you'd like to connect edge-to-edge, then you I think the best way would be to try to find the nearest edge at the estimated landing point. The finally test that there's no intersection along the way.


--mikko

Reply all
Reply to author
Forward
0 new messages