Re: [Algorithms] Physic : impulse computation
Brought to you by:
vexxed72
From: Neal T. <ne...@ps...> - 2000-09-11 10:41:51
|
Christian BRUNO <br...@if...> writes: >I have a question on impulse computation for the particular case where one >of the colliding objets has an infinite mass. I mean, this object cannot >change its position or orientation. >In the case where 2 "moveable" objects collide, i know how to compute the >+F >and -F forces that will prevent inter-penetration, but these forces apply to >both objects, and change the position and orientation of my "fixed, static" >object. >To prevent the fixed object from moving, or rotating, is it "physically >correct" to apply 2*F to the only moveable object and a null force to the >fixed object ? >any help greatly appreciated The general form for calculating an impulse for a frictionless collision between two rigid bodies is: j = -(1 + e) vRel / (A + B + C + D) where A = 1 / Ma B = 1 / Mb C = n Dot ((Inverse(Ia) x (Ra cross n)) cross Ra) D = n Dot ((Inverse(Ib) x (Rb cross n)) cross Rb) Here Inverse is the matrix inverse operation, dot is vector dot product, cross is vector cross product, and x is matrix by vector transform. In the numerator, e is the coefficient of restitution and vRel is the relative velocity of the point of contact (see below). In the various terms of the denominator, n is the normal at the point of contact, Ra is the position of the point of contact relative to the centre of mass for body a, Rb is the position of the point of contact relative to the centre of mass for body b, Ma and Mb are the masses of bodies a and b respectively, and Ia and Ib are the inertia tensors of bodies a and b in the space in which you are working (usually world space). For a collision when we know body b is immoveable, we can assume that Mb is infinity and Inverse(Ib) is the zero matrix in whatever space we are working. Thus we have: A = 1/Ma B = 0 C = n Dot ((Inverse(Ia) x (Ra cross n)) cross Ra) D=0 and we can calculate the relative velocity VRel for this case using vRel = n Dot (vLinRel + (OmegaRel cross Ra)) where Dot and cross are defined as above, + is vector addition, vLinRel is the relative linear velocity of the two bodies, Omega is the angular velocity of body a, and Ra is the position of the point of contact relative to the centre of mass of a. You can then calculate the collision impulse j using these expressions for the numerator and denominator, and apply it to the linear and angular momenta of body a, using: MomA = MomA + j (since the impulse represents an instantaneous change in momentum) and AngMomA = AngMomA + (j cross Ra) where j, Ra, cross and + are defined as above, and MomA and AngMomA are the linear and angular momenta of body a. Body b, since it has an infinite mass and a zero inverse inertia tensor, is not affected by the impact in any way. Hope that was some use, anyway... (and I hope I didn't make a mistake typing out all the equations:-) - but hopefully the principle is reasonably clear even if I've lost a sign somewhere). Neal Tringham (Sick Puppies) ne...@ps... ne...@em... |