Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Apr 04, 2012 4:05 pm 
Offline

Joined: Sun Jan 15, 2012 11:19 pm
Posts: 2
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.


Top
 Profile  
 
PostPosted: Thu Apr 05, 2012 1:14 pm 
Offline

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group