Mail Archives: djgpp/1997/02/03/18:10:48
Pyro Technic wrote:
> How would I get a ball to bounce realisticly. The constant velocity and
> four directions I have noe just just. Do I need an algorithim,
> logirithm, or some other thing a newbie like myself has never heard of.
With gravity, or without? What does it bounce off of?
I'll assume you want a round ball bouncing against a flat surface,
taking gravity into account.
One simple way is to keep track of the ball's position and velocity.
Just add an accelation constant to the velocity each frame and negate
the ball's velocity when it hits the ground. Add the velocity to the
position each frame, and draw the ball; it should move parabolically.
I've done this, and it works fine. It also takes virtually no processor
time...
-- Yamaha / XYZZ "May farce the with be you."
mailto:scriven AT CS DOT ColoState DOT edu
mailto:scriven AT VIS DOT ColoState DOT edu
http://www.vis.colostate.edu/~scriven/
- Raw text -