Getting contact face from rigid body and soft body collision

silenthunter
Posts: 8
Joined: Wed Apr 06, 2011 7:48 pm

Getting contact face from rigid body and soft body collision

Post by silenthunter »

I'm trying to get the face(s) that is being contacted in a rigid vs soft body collision. I'm doing this so I can use UV coordinates to paint that area in Ogre.

Currently I can get the nodes that are contacting on the soft body, but I don't have much info about the rigid body contact points.

Code: Select all

psb->m_rcontacts[i]
Is there any simple way to get the contacted face on the rigid body or at least nearby vertices?
User avatar
dphil
Posts: 237
Joined: Tue Jun 29, 2010 10:27 pm

Re: Getting contact face from rigid body and soft body colli

Post by dphil »

Perhaps some of the difficulty you are having is because some bodies don't have the same kind of notion of vertices/faces as a typical mesh. A btSphereShape, for example, is an implicit representation, I think, so it doesn't use actual vertices or faces. If you are using a triangle-based rigid body such as a btGImpactMeshShape or btBvhTriangleMeshShape, then maybe this thread could help: http://bulletphysics.org/Bullet/phpBB3/ ... act#p22638
silenthunter
Posts: 8
Joined: Wed Apr 06, 2011 7:48 pm

Re: Getting contact face from rigid body and soft body colli

Post by silenthunter »

dphil wrote:Perhaps some of the difficulty you are having is because some bodies don't have the same kind of notion of vertices/faces as a typical mesh. A btSphereShape, for example, is an implicit representation, I think, so it doesn't use actual vertices or faces. If you are using a triangle-based rigid body such as a btGImpactMeshShape or btBvhTriangleMeshShape, then maybe this thread could help: http://bulletphysics.org/Bullet/phpBB3/ ... act#p22638
Hmm, my rigid body is a triangle mesh, but I wasn't having any luck getting a manifold from my dispatcher. Am I doing something wrong or do soft bodies create manifolds like rigid bodies?
silenthunter
Posts: 8
Joined: Wed Apr 06, 2011 7:48 pm

Re: Getting contact face from rigid body and soft body colli

Post by silenthunter »

Alright, I ended up doing a ray test from the colliding nodes and using the LocalRayResult to get the triangle index.

Code: Select all

rayResult.m_localShapeInfo->m_triangleIndex