Get Contact normals from Ghost objects

Karrok
Posts: 65
Joined: Fri May 13, 2011 1:11 pm

Get Contact normals from Ghost objects

Post by Karrok »

Is it efficient to use ghost objects to retrieve the contact normals+penetration depth from a collision between that ghost object and any gimpact trimesh?
It's collision-only, no dynamics.

It's for a small game where depending on the penetration depth between that ghostobject and some other trimesh I end up giving a force in direction of the contact normal at that point.

What would be the best way to go about this ?
Mako_energy02
Posts: 171
Joined: Sun Jan 17, 2010 4:47 am

Re: Get Contact normals from Ghost objects

Post by Mako_energy02 »

In my experience, anything that uses GImpact is the opposite of efficient. But, assuming you have something that just addresses the horrendous performance of GImpact(such as a very low number of objects being simulated or low number of given collisions at any one time), then you absolutely can do what you want to do.

http://bulletphysics.org/mediawiki-1.5. ... d_Triggers

What you are looking for is something like what is mentioned in the "btGhostObject" section. Iterate over the contact manifolds and their contact points, and check the normals stored there. The penetration depth is also there in the form of "m_distance1" member on the contact point.
MaxDZ8
Posts: 149
Joined: Fri Jun 24, 2011 8:53 am

Re: Get Contact normals from Ghost objects

Post by MaxDZ8 »

Thank you very much Mako, I will have to remember this.