# Ball moving?

I have a ball(sphere) and I want it to move accross the floor…I have the sphere and everything but making it rotate when its moving is the hard part. I have a texture on the ball and if I move it forward I want it to rotate down like a ball would if you pushed accross the floor. I’ve read some things but I can’t seem to get it to rotate right. Examples would be appreciated.

you should be able to use trig to figure it, its dependant on the size of the ball, and the speed its rolling, but i dont know trig

Originally posted by Eber Kain:
you should be able to use trig to figure it, its dependant on the size of the ball, and the speed its rolling, but i dont know trig

ignore this comment, he obviously doesnt know what he’s on about… i’d suggest making the mapping coords dynamic and not static. but thats just a guess as ive avoided texture mapping until recently.

that is all

luke

I would rather rotate the ball rather than the texture on it if the ball is made from few faces, as then the texture may experience dancing as it passes from one face to another. And if the texture is rather high-frequency, it could actually enhance the fact that the ball itself is not really rolling.

I need code people! Telling me ideas does not help me solve my problem!

Rotatef(angle, 0.0, 0.0, 1.0);

Actually, the trig comment is not far off.

You can rotate the ball by degrees and move it away by distance. Since the circumference of the ball is 2piradius and the movement is 360 degrees for one full rotation you just need to rotate the ball 1 degree for every ((2piradius)/360) units that it moves.

I don’t know a hell of a lot about OpenGL yet, but I know Math grins