# Physics of a ball

So I’m rendering a sphere, and I want it to move around like a ball does. Does anyone know where I can find information on the physics involved as to the movement of a ball?

First, you need a second ball. Then you need a dick. To find physical behaviour you could try self-experiments.

OH, Thanx so much for the gay replys, mmmmmm…people are so helpful

I suppose you’re asking how to handle bouncing. That’s simple : if you’ve got the speed vector v of the ball, after bouncing on the plane P, the new speed vector is r(v), where r is the reflection by plane P.
for example, if P is the horizontal plane (x0y), and v=(vx,vy,vz), then r(v)=(vx,vy,-vz).

Hope this helps
Morglum

Well, that’s not exactly what I was looking for. I want to know how a ball rolls around on a flat surface. If I give the ball momentum in a direction I want to make it roll realistically.

Well, if it rolls on a flat surface, that is, a plane, all you have to check is that it’s momentum matches its speed. Well, if you know its radius, where’s the problem ? speed = radius * momentum ?!

Oh, or maybe you’re considering a momentum around a non-horizontal axis ? Like a spinning top ? Then it’s more tough. You could look for any basic text on solid mechanics.

I have been trying to make my ball bounce properly for days to no avail, its really beginning to piss me off now. Can anyone help please? I have tried a couple of different methods and this is as close as I have come so far, unfortunately it only on polygons facing upwards

``````	if( ball.getActive( ) )
{
ball.moveBall( );
MyPolygon hit;

{
Vector3d newVector;
Vector3d hitNormal = *hit.getNormal( );
Vector3d ballMovement = *ball.getMove( );

//			cout << hitNormal << endl;

newVector = crossProduct( -ballMovement, hitNormal );
newVector = crossProduct( hitNormal, -newVector );
//			newVector.triple[ Y ] += absolute( ballMovement.triple[ Y ] );			//workaround!!
ball.setMove( newVector );
}
}
``````

Hmmm. Sound familiar. Check this thread for part of the answer to bouncing ( http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/008162.html ). If you want to be more realistic you can make the ball loose momentum with each bounce.

``````v1 = v - 2 * dot(v, N) * N
v1 *= MomentumLoss                 // where 0 < MomentumLoss < 1.
``````

You can also add gravity and friction to the ball’s general movement to make it more realistic. I can’t help you with the rolling part though. I never figured out the maths to that.

To make a ball roll should be very simple, just take a circumference of the ball.
This will give you the distance the ball will move in one rotation, then just translate and rotate the ball based on that.

Originally posted by Eclipix:
Well, that’s not exactly what I was looking for. I want to know how a ball rolls around on a flat surface. If I give the ball momentum in a direction I want to make it roll realistically.

xdot = some_constant
x = x + xdot*timestep

ydot = some_constant
y = y + ydot*timestep

(zdot)dot = -g

zdot = zdot + (zdot)dottimestep
z = z + zdot
timestep

g = 9.80m/s^2

when the ball hits the surface let zdot = -zdot*damping. damping == 1 for perfectly elastic, 0 <damping <1 to loose momentum.

These are the equations of motion for your ball. (z is the vertical axis).

[This message has been edited by nickels (edited 05-06-2002).]

[This message has been edited by nickels (edited 05-06-2002).]