Rotating billiard ball

Started by
2 comments, last by toto1919 17 years, 7 months ago
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!
Advertisement
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.
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.
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...

This topic is closed to new replies.

Advertisement