#### Archived

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

# ball rotation...

This topic is 6126 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 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.

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.

##### Share on other sites
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!

1. 1
2. 2
3. 3
4. 4
5. 5
Rutin
11

• 12
• 19
• 10
• 14
• 10
• ### Forum Statistics

• Total Topics
632665
• Total Posts
3007711
• ### Who's Online (See full list)

There are no registered users currently online

×