PDA

View Full Version : Ball moving?



detzel
06-21-2001, 01:22 PM
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.

Eber Kain
06-21-2001, 08:24 PM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif

06-22-2001, 06:38 AM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif

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

DFrey
06-22-2001, 07:12 AM
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.

detzel
06-22-2001, 02:00 PM
I need code people! http://www.opengl.org/discussion_boards/ubb/wink.gif Telling me ideas does not help me solve my problem!

MrShoe
06-24-2001, 11:47 PM
Rotatef(angle, 0.0, 0.0, 1.0);

Teriodin
06-25-2001, 12:05 AM
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 2*pi*radius and the movement is 360 degrees for one full rotation you just need to rotate the ball 1 degree for every ((2*pi*radius)/360) units that it moves.

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