habitat-sim icon indicating copy to clipboard operation
habitat-sim copied to clipboard

Extract Collision Normal Vector

Open araistrick opened this issue 5 years ago • 1 comments

❓ Questions and Help

For my project, I need to be able to extract normal vectors of surfaces the agent collides with.

I found the HitRecord class and associated function closest_obstacle_surface_point, and have thought of just calling that function to approximate collision normals, but I have found it gives lots of nan values, and am wondering if there is a better method

araistrick avatar Jun 01 '20 18:06 araistrick

The normal there unfortunately won't be useful when the agent is in contact with a surface as it is just normalized(agent_position - hit_position). There also isn't an easy way to get the true surface normal as the collision library we use doesn't seem to support this. The likely correct place to add this functionality is extended the function here https://github.com/erikwijmans/recastnavigation/blob/354591e10a772b8057e42a4f9de701155b9aaa02/Detour/Source/DetourNavMeshQuery.cpp#L3530. I can do this at some point (not sure when I will have the cycles tho).

Yay for already having our own fork to make extending this easier at least!

erikwijmans avatar Jun 02 '20 19:06 erikwijmans