Page 1 of 1

Force Computation Without Velocity

Posted: Wed Apr 04, 2012 4:05 pm
by bulevren
I have two mesh shapes. When their positions collide with each other, how can I compute their forces due to the collision. In my scenario, I have not any velocity, I can just give their positions. And I should not use glutStuff or OpenGL functions.

int numManifolds = m_dynamicsWorld->getDispatcher()->getNumManifolds();
for (int i=0;i<numManifolds;i++)
btPersistentManifold* manifold = m_dynamicsWorld->getDispatcher()->getManifoldByIndexInternal(i);
for (int p=0;p<manifold->getNumContacts();p++)
totalImpact += manifold->getContactPoint(p).m_appliedImpulse;

This code is working after I call glutMainLoop() but I want to ignore glut functions. I do not want to draw anything, I just want to compute the forces.

Thank you.

Re: Force Computation Without Velocity

Posted: Thu Apr 05, 2012 1:14 pm
by bone
If there's no velocity, those impulses are presumably going to be zero. Most game physics engines depend on solving contact impulses to resist penetration by clipping the penetration velocity to zero.

I don't know what your application is, but it sort of sounds like you want to estimate the force based on the depth and normals of the contact points, plus some 'spring rate' that you provide. It's going to be highly imperfect, since you'll only be getting the 4 "best" contact points from Bullet. But if that's the way you need to go, then the force vector would equal spring_rate*depth*normal, and you'd apply it at the point of contact.