Link to the paper http://www.icvonline.com/gdc_dir/files/ ... ration.pdf
I'm new to rigid body dynamics and have been toying around with Rick Baltman's paper on "Verlet Integration and Constraints in a Six Degree of Freedom Rigid Body Physics Simulation" for the past two weeks. I pretty much followed almost all the formulas written in the paper (haven't done the collision part though), and I have the basic working. Notice I bolded the word almost.
When I was doing the angular constraint. I noticed that q_correction resulted from equation 8.6 is not correct. I noticed that if minimum angle is violated, q_correction will rotate the bodies so that both bodies will violate or almost violate the maximum angle (also vice versa). For example, minimum angle of x-axis is -30, current x-axis angle between bodies is -31 (constraint violated), the resulting q_correction rotates both bodies so that their x-axis angle is around +29, about 60 degree rotation (The visual result from this is sudden snap. Imagine two rigid bodies with pin and angular constraint shaped like ">" and on the next frame it becomes "<"). I'm not an expert in quaternions and its intricate operations, I have checked my code over and over again, I am sure my code is an exact translation of the formulas in the paper.
Then I changed equation 8.4 in my code, so that it looks like this (only put x-axis, should be similar for y & z-axis).
Code: Select all
if ( dq_a.x < q_min.x ) { dq_a.x = q_min.x - dq_a.x }
else if ( dq_a.x > q_max.x ) { dq_a.x = q_max.x - dq_a.x }
Code: Select all
q_correction = dq * dq'
Code: Select all
q_correction = dq'
So, I was wondering if anyone has ever tried to implement the paper fully ? Did you get the same result as I did ? I just would like to confirm if my fix is correct and that I didn't misunderstood the formulas in the paper. Any help is very much appreciated!
Thank you very much!