Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Projectile physics, ball ballistics

This thread is locked; no one can reply to it. rss feed Print
Projectile physics, ball ballistics
Julian
Member #1,309
May 2001
avatar

Can anyone please refresh my high school knowledge of ball physics. I have the basic equations for calculating ball flight given an initial velocity, elivation and direction in 3D space. I just wondered if anyone can direct me to a resourse for best calculating the bounce of the ball each time. I have done this from first principles but are being a bit lazy and wondered if there was a collection of simple equations available?

felix watts
Member #914
January 2001

Don't know how accurate you want your model, heres a simple but effective one...
On each bounce the ball loses energy so it dosen't bounce as high as it fell from i.e
if(bounce()){ yVel = -efficiency*yVel; }
where efficiency is some factor like 0.75. If you want the ground to have friction do
if(bounce()){xVel = friction*xVel; }
again friction is some factor like 0.9.
Hope that helps.

Julian
Member #1,309
May 2001
avatar

Thanks Zaphoid. I have used a similar equation like this and it works. I couldnt recall if friction was velocity dependent i.e should friction be applied as a faction of velocity or should it be a constant subtracted at each iteration (velocity independant)?

felix watts
Member #914
January 2001

Thats a good question - I suggest you try both to see which looks better (you've probably aready done that though). :)
-zaph

wolfman8k
Member #508
July 2000
avatar

To do friction you always subtract the same length from the vel vect. Otherwise, a rolling ball would never stop rolling!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ Machine Ball - Futuristic 3D Sport ]

Jason Heim
Member #484
June 2000

wolfman8k is right except for when the object is at rest. friction is a reactive force, so it doesn't take effect until another force comes into play for it to act against. otherwise the ball would never come to rest either.
once the applied force is greater than the force of friction, the object moves and the total force becomes the force of acceleration minus the force of friction, which can be made constant for simplicity's sake and look very realistic.
but, once the object is in motion, if the applied force of acceleration matches the force of friction, the object moves at a constant rate. so, depending on how you want to make your game physics work, you may want to increase friction as velocity increases, as suggested by julian. this is how a 'maximum speed' is reached - at some point the force of friction matches the maximum force that can be applied for acceleration.
once the force of acceleration becomes less than the force of friction, the object slows down.
make sense? i hope so, i do ramble on so badly sometimes...
good luck!
jase

Ricky Piller
Member #1,232
April 2001
avatar

Does a Billy Madison Blow at the Clarinet
he's good :)

Bruce Perry
Member #270
April 2000

Yep, this has been discussed before, and I prevailed :-P
Just one thing to add: don't confuse friction with air resistance (sometimes also called friction or air friction). With air resistance, the opposing force is (generally) proportional to the square of the velocity. You'll have to be careful how you apply this, since the discreteness of computer maths could send the ball shooting off in the opposite direction!

--
Bruce "entheh" Perry [ Web site | DUMB | Set Up Us The Bomb !!! | Balls ]
Programming should be fun. That's why I hate C and C++.
The brxybrytl has you.

Araanor
Member #990
February 2001
avatar

Ooh, friction??
T'was some months ago. The results were sufficient... for the time. Not satisfying. Must re-design and separate air-/ground-friction, yeeeesshhh...

Go to: