Re: Navmesh Z-up coordinate transform

383 views
Skip to first unread message
Message has been deleted

Patrick Baggett

unread,
Jul 2, 2015, 10:05:49 PM7/2/15
to recastnavigation
I'm not sure I understand ... You implemented the transform from Y-up to Z-up, but it doesn't look like your input geometry is correct (looking at the photo). Don't worry about generating the navigation mesh until that is correct. Once your mesh loads correctly, you simply do the inverse of the operation when you save your navmesh, or when you load it in your engine.

Looking at your photo, you have the up axis pointing along the wrong axis. Maybe you shouldn't be transforming anything. What does the code look like when running without a transform?

On Thu, Jul 2, 2015 at 8:42 PM, Augusto Moura <augustopi...@gmail.com> wrote:
Hi guys,

first of all, thank you for this amazing project :)

I found this topic: https://groups.google.com/forum/#!topic/recastnavigation/bku5sMRP4S0 and i need to build a navmesh in the Z-up coordinate system, and i have taken the Recast Demo to test it before implementing to my engine
this is the code from the topic:
inline void customToRecast(const Vec3& v, float* p)
{
        p
[0] = -v.x;
        p
[1] = v.z;
        p
[2] = v.y;
}

inline Vec3 recastToCustom(const float* p)
{
       
return Vec3(-p[0], p[2], p[1]);
}
and this is how the modified code:
*dst++ = -x*m_scale;
*dst++ = z*m_scale;
*dst++ = y*m_scale;
i know that i need to transform my meshes and after that transform the navmesh back, but i don't know exactly how to do it

the first thing i switch Y and Z on MeshLoaderObj.cpp line 55, maybe isn't the best way to do it but the mesh and the InputGeom are working fine, as you can see here:


but, how can i do to the navmesh to be generated properly? (i mean, what file and line i can modify)

Thanks

--

---
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.

Message has been deleted

Patrick Baggett

unread,
Jul 2, 2015, 10:50:24 PM7/2/15
to recastnavigation
I don't think that makes any sense. If your conversion from Engine -> Recast is correct, then it should look correct. That's the whole point of coordinate conversions.

Here is what I expect:

1) Import mesh - no coordinate conversion - looks wrong in RecastDemo. NavMesh generation is wrong.
2) Import mesh - apply coordinate conversion - looks right in RecastDemo. NavMesh generation is wrong.

In 1), a coordinate change is required, but not applied. In 2), a coordinate change is required, and then applied.

However, here is what you're telling me:
3) Import mesh - apply coordinate conversion - looks "wrong" (?) in RecastDemo. NavMesh generation is wrong.

This makes me wonder whether a) you have the right coordinate conversion or b) you need coordinate conversions at all.

Maybe you should look into the OBJ file you are loading -- is it really Z-up?

On Thu, Jul 2, 2015 at 9:24 PM, Augusto Moura <augustopi...@gmail.com> wrote:
Actually the result on the image is exactly what i want, because i need to get it "wrong" inside RecastDemo, so when i implement this on my engine it will appear correctly (my objective inside RecastDemo is to build the navmesh on the "wall", because it works with Y-up, but only my engine uses Z-up)
only the generated navmesh on the image that is wrong
Message has been deleted

Flappy_Linyuan

unread,
Jul 3, 2015, 12:40:13 AM7/3/15
to recastna...@googlegroups.com
I am not sure you can generate navmeshes on other planes beside x-z,  you may change your own model directions, for example, you want to generate the mesh on your x-y plane, you may need to change your all ordinates from [x, y, z] to [x, z, y] before pass into detour. now the x-z plane for detour is exactly x-y plane of your model.

在 2015年7月3日星期五 UTC+8上午11:29:21,Augusto Moura写道:
sorry, maybe i don't know if i'm the right way, but i choose a bad way to explain it
my OBJ is the same as recast demo, this image is actually the recast demo with just these lines modified, nothing more,

but i was thinking that if i transform the original mesh it will generate a InputGeom, so, when i send it to the Recast navmesh builder it generates the navmesh on the right "shape", the navmesh will be on the wrong axis, so after that i transform the navmesh "back" and it will be on the right place

but nevermind, i think i'm explaining in a confuse way, lol 

in another point of view, i just want to change the direction where Recast builds the navmesh, instead of in the floor it needs to be on the "wall", so when i move the code to my engine it will generate the navmesh on the "right" place
Message has been deleted

Augusto Moura

unread,
Jul 3, 2015, 1:19:50 AM7/3/15
to recastna...@googlegroups.com
nevermind, finally i understand how it works, actually when i transform the mesh recast build it right, but i can't see it because my character and the debug drawer are not converting the positions, so i just need to update the debug drawer and convert the character position with the transform of the position

sorry guys, and thank you for your support :)

(i will delete this topic)

Em sexta-feira, 3 de julho de 2015 02:03:40 UTC-3, Augusto Moura escreveu:
actually inside my engine Recast builds the navmesh perfectly in my mesh on the scene, but not in the top, but the side of the object, so i can make a character follow my camera up/down position without any conversion, if i transform the mesh before building the navmesh it continues building the side of the object, but now the character follows the camera on "top" of the object, but the navmesh is wrong because Recast build it using the side of the object
Reply all
Reply to author
Forward
0 new messages