A Flash Developer Resource Site

1. ## bouncing ball physics

hi all

i was wondering if anyone knew of a basic outline of steps to take when trying to animate a ball bouncing.

here's what i've come up with

*note i'm just working with velocity and acceleration in y direction right now...

get ball's yposition
if ball has been detected to hit "ground"
get the ball's velocity right when it hits ground
calculate current kinetic energy (k=1/2 mv^2)
decrease kinetic energy by a set value
recalculate velocity using new kinetic energy value
change velocity vector so it bounces up now

i'm working with 3dfa right now and i haven't been concerned with dealing with an upper limit (how high should the ball bounce before it comes back down)

can someone tell me if i'm on the right track? or if i'm totally off...

sanou

2. ## Bouncing

That sounds O.K. for the bouncing, though I'm not sure a ball loses the same amount of energy with each bounce. A harder bounce deforms the ball more, should sap more energy. If your ball is also subject to gravity, then you'll want to account for that, which will limit the height.

3. gravity tutorial at www.bit-101.com pretty much covers this. for most flash movies, you don't need to get into calculating kinetic energy or mess with mass. just reverse the velocity on the axis it hit. deduct some velocity for loss of energy. if you are doing a scientific simulation, you may need more, but if you just want a bouncing ball...

#### Posting Permissions

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

 » Home » Movies » Tutorials » Submissions » Board » Links » Reviews » Feedback » Gallery » Fonts » The Lounge » Sound Loops » Sound FX » About FK » Sitemap