# Rotating billiard ball

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

## Recommended Posts

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!

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

##### Share on other sites

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.

##### Share on other sites

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

1. 1
Rutin
44
2. 2
3. 3
4. 4
5. 5

• 13
• 10
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632996
• Total Posts
3009777
• ### Who's Online (See full list)

There are no registered users currently online

×