Getting surface normal from manifold

shultays
Posts: 4
Joined: Thu Apr 09, 2015 2:34 pm

Getting surface normal from manifold

Post by shultays »

I am using contactTest to get contact between a sphere/capsule and different types of collision objects. In my custom callback, I use m_normalWorldOnB for normals but It is not the surface normal, it is the normal between collision points I believe.

For example if it is an endless plance looks from 0,0,0 to 0,0,1 I want the 0,0,1, how can I find the surface normal for collisions? I believe rayTest gives such normal, so after the contactTest I tried to use rayTestSingle but couldn't make it.
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Getting surface normal from manifold

Post by drleviathan »

My experience has been that btManifoldPoint::m_normalWorldOnB is pretty accurate as to the surface normal of the contact so I would expect it to be usable for most applications.

Meanwhile the btSingleRayCallback method should also work in theory. You would test a ray against the other collision object aimed at the contact point.

Post a link to your demo code and maybe someone will have time to look it over.