A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: bouncing ball physics

  1. #1
    Junior Member
    Join Date
    Dec 2002

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


  2. #2
    ActionScript Insomniac
    Join Date
    Jan 2003
    43d03.21'N, 89d23.65'W


    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. #3
    Senior Member
    Join Date
    Jan 2002
    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

Click Here to Expand Forum to Full Width

HTML5 Development Center