btManifoldResult contact point world positions not filled in

slithEToves
Posts: 24
Joined: Mon Mar 12, 2007 9:55 pm

btManifoldResult contact point world positions not filled in

Post by slithEToves »

It appears that the world positions are not filled in when addContactPoint is called on a btManifoldResult.

I added the following lines to my btManifoldResult.cpp, just after the btManifoldPoint is constructed on line 72:

newPt.m_positionWorldOnA = pointA;
newPt.m_positionWorldOnB = pointInWorld;

Did I need to do this or is there a different place this is or should be filled in?

Thanks.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

Bullet uses a persistent contact manifold, so the world positions of the contact points change over time. THerefore the world positions are re-calculated every frame, as new points come and invalid/old points get dropped.

Code: Select all

contactManifold->refreshContactPoints(obA->getWorldTransform(),obB->getWorldTransform());
For examples, see CollisionInterfaceDemo (if you only use Bullet's collision detection).

If you use both Bullet collision detection and dynamics, then it happens during constraint solver phase. See Bullet/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp

Code: Select all



void	btSequentialImpulseConstraintSolver::prepareConstraints(btPersistentManifold* manifoldPtr, const btContactSolverInfo& info,btIDebugDraw* debugDrawer)
{
...
	//only necessary to refresh the manifold once (first iteration). The integration is done outside the loop
	{
		manifoldPtr->refreshContactPoints(body0->getCenterOfMassTransform(),body1->getCenterOfMassTransform());

}
slithEToves
Posts: 24
Joined: Mon Mar 12, 2007 9:55 pm

Post by slithEToves »

Ok, I understand. I am using just the narrowphase collision, and so this doesn't happen for me. Thanks for the answer.