Force Computation Without Velocity

Please don't post Bullet support questions here, use the above forums instead.
Post Reply
bulevren
Posts: 2
Joined: Sun Jan 15, 2012 11:19 pm

Force Computation Without Velocity

Post 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.
bone
Posts: 231
Joined: Tue Feb 20, 2007 4:56 pm

Re: Force Computation Without Velocity

Post 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.
Post Reply