How to determine correct collision normals?

User avatar
BrightBit
Posts: 6
Joined: Fri Dec 31, 2010 8:51 pm

How to determine correct collision normals?

Post by BrightBit »

Hello bullet community,

I am writing a character controller and need to determine the correct normal of an object the controller is colliding with. However, mechkg said (in his "m_hitNormalWorld meaning" thread) and I also noticed it myself that the m_hitNormalLocal given by a LocalConvexResult in a callback isn't always correct.

But I need a way to get the correct normal for sliding along walls and similar character controller related stuff. Erwin mentioned a way to accomplish this:
Erwin Coumans wrote:In case the convex sweep test runs into a triangle mesh, the triangle/part index (that determines the hit normal) could be exposed (need to look further into this).
I didn't really understand what he tried to explain, though. Can anyone help me?


Greetings
BrightBit
justin
Posts: 8
Joined: Fri Mar 04, 2011 1:19 pm

Re: How to determine correct collision normals?

Post by justin »

BrightBit wrote:Hello bullet community,

I am writing a character controller and need to determine the correct normal of an object the controller is colliding with. However, mechkg said (in his "m_hitNormalWorld meaning" thread) and I also noticed it myself that the m_hitNormalLocal given by a LocalConvexResult in a callback isn't always correct.

But I need a way to get the correct normal for sliding along walls and similar character controller related stuff. Erwin mentioned a way to accomplish this:
Erwin Coumans wrote:In case the convex sweep test runs into a triangle mesh, the triangle/part index (that determines the hit normal) could be exposed (need to look further into this).
I didn't really understand what he tried to explain, though. Can anyone help me?


Greetings
BrightBit
I run into the same trouble of determining the normal when collision happens.
And I think what Erwin tried to explain is that by getting the triangle index which is exposed we can get the normal of the surface by ourselves (for example, cross product of any to edge vectors).