Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Physics of a ball

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2002
    Location
    Gunnison, CO, USA
    Posts
    22

    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?

  2. #2
    Guest

    Re: Physics of a ball

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

    _/\_EgLaDiL_/\_

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2002
    Location
    Gunnison, CO, USA
    Posts
    22

    Re: Physics of a ball

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

  4. #4
    Member Regular Contributor
    Join Date
    Jul 2001
    Posts
    409

    Re: Physics of a ball

    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

  5. #5
    Junior Member Newbie
    Join Date
    Feb 2002
    Location
    Gunnison, CO, USA
    Posts
    22

    Re: Physics of a ball

    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.

  6. #6
    Member Regular Contributor
    Join Date
    Jul 2001
    Posts
    409

    Re: Physics of a ball

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

  7. #7
    Member Regular Contributor
    Join Date
    Jul 2001
    Posts
    409

    Re: Physics of a ball

    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.

  8. #8
    Intern Contributor
    Join Date
    Jan 2002
    Posts
    52

    Re: Physics of a ball

    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

    Code :
    	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 );
    		}
    	}

  9. #9
    Member Regular Contributor
    Join Date
    Jan 2002
    Location
    Kingston, Jamaica, W.I.
    Posts
    268

    Re: Physics of a ball

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

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

  10. #10
    Senior Member OpenGL Guru
    Join Date
    Jun 2000
    Location
    Gastonia, NC, USA
    Posts
    2,096

    Re: Physics of a ball

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •