This topic is now archived and is closed to further replies.


2D vector collision response

Recommended Posts

These are the equations I've come up with, please respond with comments, corrections, etc.. Basically these are the equations given by Chris Hecker in his 3rd article on Rigid Body Dynamics, minus the rotation segment. the CVector class I'm using here is from
void bounce(object &a, object &b)
		float e = coef;
		float m1 = a.mass;
		float m2 = b.mass;
		CVector C;
		C.x = centerx(a) - centerx(b);
		C.y = centery(a) - centery(b);
		CVector Vab = a.velocity - b.velocity;
		CVector n = GetNormal(C);

		float impNumerator = -(1+e)*(Vab % n);
		float impDenominator = ((n*(1/m1 + 1/m2)) % n);
		float impulse = impNumerator / impDenominator;			
		a.velocity += n*(impulse/m1);
		b.velocity -= n*(impulse/m2);

*Just in case you're confused, the CVector class has an inlined modulus operator returning the dot product. Edited by - eotvos on March 20, 2002 1:23:39 AM

Share this post

Link to post
Share on other sites