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


ball rotation...

Recommended Posts

Hi, everybody! I don''t speak (and write) English well. I''m sorry!!!! But I''m trying to make a simple billiard game and this site is where I found the most interesting articles on physic simulation and game programming. So I do try to write in right way... I''ve a "little" problem... Everything seems to go well... but ball rotation doesn''t look ok. ...the ball begins to roll well, but after little time it begins to roll around a wrong axis until it allineates with the same direction every time and rotates so long around the same axis. So, whatever is the initial orientation, finally it rotates around the same "wrong" axis. Because of the final wrong axis is always the X axis I think the problem is in the following code. Look at this code: Matrix& Matrix:: Normalize () { Vector X(Mat[0][0], Mat[1][0], Mat[2][0]); Vector Y(Mat[0][1], Mat[1][1], Mat[2][1]); Vector Z; X.Normalize(); Z = (X ^ Y); Z.Normalize(); Y = (Z ^ X); Y.Normalize(); Mat[0][0] = X(0); Mat[0][1] = Y(0); Mat[0][2] = Z(0); Mat[1][0] = X(1); Mat[1][1] = Y(1); Mat[1][2] = Z(1); Mat[2][0] = X(2); Mat[2][1] = Y(2); Mat[2][2] = Z(2); return (*this); } I use this method to normalize a matrix the coloumns of which represent the axes of orientation of the ball in the 3d-space. I use X axis to (re)normalize the other two. Maybe it''s a round-off error problem?! Anyway, could you suggest me links to interesting resources about this matter? Thanks, very much!!

Share this post

Link to post
Share on other sites
I don''t think the rotation problem is related to the Normalize() function you presented.

I can point you to a couple of resources that may be helpful. The first is a demo program on nVidia''s web site, which includes billiard-style rotating balls (among other things):

This is the "RigidBody" OpenGL demo by Tomohide Kano, which is very cool. Unfortunately, there is no available source code, but its nice to look at.

The next resource will be more helpful, as it discusses the mathematics of simple pool table physics. Its an article by Jeff Lander, originally published in Game Developer Magazine.

Hope this helps!

P.S. Your English is actually quite good!

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.

Share this post

Link to post
Share on other sites