Eclipix

05-04-2002, 09:16 AM

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?

View Full Version : Physics of a ball

Eclipix

05-04-2002, 09:16 AM

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?

05-04-2002, 09:30 AM

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

_/\_EgLaDiL_/\_

_/\_EgLaDiL_/\_

Eclipix

05-04-2002, 09:58 AM

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

Morglum

05-04-2002, 10:04 AM

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

for example, if P is the horizontal plane (x0y), and v=(vx,vy,vz), then r(v)=(vx,vy,-vz).

Hope this helps

Morglum

Eclipix

05-04-2002, 10:11 AM

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.

Morglum

05-04-2002, 10:26 AM

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 ?!

Morglum

05-04-2002, 10:29 AM

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.

endo

05-05-2002, 10:23 AM

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 http://www.opengl.org/discussion_boards/ubb/frown.gif

if( ball.getActive( ) )

{

ball.moveBall( );

MyPolygon hit;

if( ballPaddleCollision( paddle, *ball.getLoc( ), ball.getRadius( ), 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 );

}

}

if( ball.getActive( ) )

{

ball.moveBall( );

MyPolygon hit;

if( ballPaddleCollision( paddle, *ball.getLoc( ), ball.getRadius( ), 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 );

}

}

Furrage

05-06-2002, 05:52 AM

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.

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.

nexusone

05-06-2002, 06:23 AM

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.

http://www.opengl.org/discussion_boards/ubb/smile.gif

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.

This will give you the distance the ball will move in one rotation, then just translate and rotate the ball based on that.

http://www.opengl.org/discussion_boards/ubb/smile.gif

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.

nickels

05-06-2002, 07:08 AM

xdot = some_constant

x = x + xdot*timestep

ydot = some_constant

y = y + ydot*timestep

(zdot)dot = -g

zdot = zdot + (zdot)dot*timestep

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

x = x + xdot*timestep

ydot = some_constant

y = y + ydot*timestep

(zdot)dot = -g

zdot = zdot + (zdot)dot*timestep

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

Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.