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

Rotating billiard ball

Started by toto1919 Sep 16, 2006 at 3:30 PM 2 replies 1.1k views
Original Post
toto1919
toto1919
I am having problem understanding how to rotate spheres properly in 3-d. I made a pool table and a ball. If the ball moves lets say x+=10, y+=10 and z+=0. How do I rotate the ball around x,y&z axis? Go easy on me. Not the most brilliant guy on this planet... Please help!
Zakwayda
Zakwayda
Without getting into a full-on physics simulation, the easiest way to rotate the ball in a way that appears correct is to rotate about an axis perpendicular to the surface normal and the direction of motion, with the amount of rotation computed from the circumference of the ball and the distance traveled.
toto1919
toto1919
Thanx for your reply. If I put it in another way...

When I have this:

Example 1
Ballmovement x+10, y+0, z+0
BallRot x+10, y+0, z+0

or...

Example 2
Ballmovement x+0, y+10, z+0
BallRot x+0, y+10, z+0

it works fine... But if the ball is heading (just thinking of x and y) south east (or down and right)...

Example 3
Ballmovement x+10, y+10, z+0
BallRot x+10, y+10, z+0 (Of course the ball travels longer now, than in the first two examples, but... just an example)

When I do this my ball is not rotating correctly (in SE direction), it is swearving. I don't know... Am I using the wrong technic or do I have some other faults in the rest of the programming code? I'm trying this in OpenGL.

Hoping you all understood my question.
toto1919
toto1919
Sorry for this thread...

I see what a newbie mistake I made...

I was first turning the x-axis +10 then the y +10, and so on, when I needed to turn them all in the same function... Sorry. Everything clear for me now... Well not everything, but...

Topic Locked

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

Sign in to reply to this topic.