Trying to learn recastnavigation

197 views
Skip to first unread message

Alexei Andronov

unread,
Jul 1, 2023, 7:33:50 AM7/1/23
to recastnavigation
I am trying to learn how to use this library.
I am using it in python through https://github.com/Tugcga/PyRecastDetour, but the simple code examples I'm trying should be the same regardless
So far I can't get anything done and hopefully someone can guide me.

What kind of geometry does init_by_raw expect?

I've tried initializing it with a simple plane, 1 1 to 1 -1 to -1 1 to -1 -1. I've  tried initializing it with two adjacent planes, second one being from -1,1 to 1, 3. Nothing works. It fails at building navmesh regardless

for one plane:
get_bounding_box:   ((-1.0, 0.0, -1.0), (1.0, 0.0, 1.0))
Load mesh from raw data: successfully done.
Building navigation:
 - 7 x 7 cells
 - 0.0K verts, 0.0K tris
Could not build Detour navmesh.

for two planes:
get_bounding_box: ((-1.0, 0.0, -1.0), (1.0, 0.0, 3.0))
Building navigation:
 - 7 x 13 cells
 - 0.0K verts, 0.0K tris
Could not build Detour navmesh.

Also, if I want to use recastnavigation for 2D calculations, can I somehow make this work in a more simple manner? I just need to feed it 2d coordinates of my obstacles / walkable areas.

Graham Pentheny

unread,
Jul 2, 2023, 1:01:11 PM7/2/23
to recastnavigation
Hi!  

It looks like [the docstring for that init_by_raw function](https://github.com/Tugcga/PyRecastDetour/blob/088f22cfc9035c45dd4dbc3a1da4f4bc4ebd1139/recastdetour/__init__.py#L42) has a nice explanation of the data format it expects.  In general, Recast expects clockwise-winding triangles and the coordinate system Recast uses is right-handed and Y-up.

In general, a good source for guidance on getting started with Recast is Sample_SoloMesh.cpp and Sample_TileMesh.cpp in RecastDemo.  These samples go through all the major features of Recast when it comes to building navmeshes.

Hope that helps,
Graham

Alexei Andronov

unread,
Jul 3, 2023, 12:54:59 PM7/3/23
to recastnavigation
Thank you Graham! I have found my mistake to be that it was too small. Since agent was not set to 0 width, it had no way to fit. Changing that to 10 made everything work.
Reply all
Reply to author
Forward
0 new messages