I have studied rigid body simulation from "Physically Based Modeling: Principles and Practice" by David Baraff and "Physics for Game Developers",but i have some problem.
I have implemented a right collision response with impulse,and this is the result http://www.youtube.com/watch?v=A6GDqO5BUYg.
As you can see after few times the balls going in to rolling without sliding so linear velocity = angular velocity (radius is one).
Now to stops the balls i have think to study the forces that acts on body when it 's in colliding contact,so if relative velocity along normal of collision plane is round zero and the accelleration torwards the body in plane,i resolve contact like this
Code: Select all
vContactForce = (body->fMass * (
-data->vRelativeAcceleration *
data->vCollisionNormal)) *
data->vCollisionNormal;
vContactFriction = (vContactForce.Module() *
0.1) *
data->vCollisionTangent;
body->vForces += vContactForce;
body->vForces += vContactFriction;
body->vMoments +=data->vCollisionPoint^vContactForce;
body->vMoments +=data->vCollisionPoint^vContactFriction;
Code: Select all
vRelativeVelocity = body->vVelocity+(body->vAngularVelocity^vCollisionPoint);
vRelativeAccelleration = (body->vForces/body->fMass)+((body->vMoments/body->fInertia) ^ vCollisionPoint);
data->vCollisionTangent = -(vRelativeVelocity-((vRelativeVelocity*CollisionNormal)*CollisionNormal));
can you help me,please?
thx in advice
ps:the simulation is 2d