Stuck on Rotation with Verlet Integration
June 17, 2006
I think I’ve almost got the hang of 3D math now, as well as simple physics engines, like verlet integration. One online tutorial, Vector Math for 3D Computer Graphics, has been particularly helpful. A webpage on game physics in 3D has also been somewhat helpful. One area of confusion still remains in my mind, and that’s how to make a 3D object rotate in a verlet integration scheme. I think I could easily figure out how to extend 2D verlet integration into 3D in every area I require, besides rotation. The author of the webpage on game physics in 3D that I just mentioned above delves into how to integrate rotations into his physics code, but he uses quaternions. I suppose I could possibly use quaternions. Sandy has a quaternion class. I hesitate to use quaternions mainly because I’ll still be using matrixes for translation. It seems simpler to use matrixes for every kind of transform, rather than using matrixes for everything except rotation. It’s tempting to wait until 3D Math Primer for Graphics and Game Development arrives in the mail, but I’ve played that type of mind game with myself in the past, so I know better. Sometimes, it gets the point of hacking my way through the analysis paralysis - just doing it - albeit not necessarily The Best Way. That may be the point where I am now.
Other Posts Categorized as 3D Programming:
- Aegia Physics Code Samples in Director 11 - April 5th, 2008
- WOW 3D Physics Engine for Flash - January 30th, 2008
- Creating a Simple Hinge in Shockwave 3D Using the Havok Xtra - April 11th, 2007
- Director, I Missed You - February 9th, 2007
- Going Around in Circles - Back to Shockwave 3D Now - February 4th, 2007
- I've Been Martened, Tarted and Torqued - November 18th, 2006
- Sandy 1.0 Beta Released - June 24th, 2006
- A Good Tutorial on Basic 3D Math - June 7th, 2006
- A Trigonometry Tutorial - June 4th, 2006
- 3D Models of Seemingly Impossible M.C. Escher Drawings - May 2nd, 2006
its much better to use position/orientation as a vector and quaternion for physics - matrices are terrible. you cannot integrate matrices.
ps. you convert your vec/quat transform to a matrix just before rendering.
Hi, and thanks for the tip. I believe I may give quaternions a try, especially since they only store 4 variables, while matrixes store 9. That makes a difference in Flash. Chad Corbin has a tutorial on the adobe website on how to use quaternions for 3D in Flash. Sandy also has a quaternion class, but it’s untested. I’ve come this far, so I suppose I can learn how to convert quaternions to matrixes if that’s really necessary. The author of the web page on game physics in 3D says that everything just works out, without integrating the rotation with the linear transformations, at least in his verlet integration scheme. But if conversion turns out to be necessary, the 3D Math Primer for Graphics and Game Development covers conversions between quaternions and matrixes. I have the book now, so no more excuses.
The trick is to pos/quat right up to the point where you want to transform vertices — its quicker to concatenate vec/quat transforms than matrices, BUT its slower to transform points by quaternions.
also, using quaternions reduces numerical drift vs. quaternions, so they are cooler
- gaffer