Skip to main content
GameDev.net gamedev.net
🔒 Locked

ball rotation...

Started by youngboy Dec 14, 2001 at 12:51 PM 1 replies 800+ views
Original Post
youngboy
youngboy
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!!
grhodes_at_work
grhodes_at_work
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.

http://cgi3.tky.3web.ne.jp/~tkano/rigidbody.shtml
http://developer.nvidia.com/view.asp?IO=Rigid_Body_Demo

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.

http://www.gamasutra.com/features/20000516/lander_01.htm

Hope this helps!

P.S. Your English is actually quite good!

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
youngboy
youngboy
THANKS A LOT!!!!

I''ve found the resources very interesting.

Anyway, I''ve solved the rotation problem and now I''ve to add frictional forces...

Bye!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.