Force Computation Without Velocity
Posted: Wed Apr 04, 2012 4:05 pm
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.
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.