What Equation Should I Use for Bouncing on a Trampoline in a Video Game?

  • Level: Undergrad 
  • Thread starter Thread starter Subliminalman
  • Start date Start date
  • Tags Tags
    Trampoline
Join the discussion
Registration is free. Start your own thread to ask a follow-up.
3 replies · 3K views
Subliminalman
Messages
1
Reaction score
0
Currently I am making a small video game where a cat is constantly falling through the sky! I want to add in some trampolines that when hit you will bounce according to the trampolines angle.

What equation would I use to perform this function?


I have provided a picture to help illustrate what I am trying to achieve

For all of you programmers out there here is the code that I used so far

if (trampTime <= 0)
{
//trampRotation is in radians
character.velocity.Y = 10 * (float)Math.Sin(trampRotation);
character.velocity.X = 10 * (float)Math.Cos(trampRotation);
}
trampTime++;
if (trampTime > 30)
{
character.trampoline = false;
trampTime = 0;
}




Any help would be greatly appreciated
 
Attachments
  • example.jpg
    example.jpg
    5.2 KB · Views: 591
Physics news on Phys.org
You might try the Computer and Technology forum instead of General Physics. You should have the best chance of getting help there!
 
Welcome to PhysicsForums!

Since you seem to grok code, I presume that you're more interested in the physics of the situation, rather than code that models the physics.

If you make the assumption that the bounce is completely elastic (not a bad assumption, for the lulz) the angle of incidence will be the same as the angle of reflection, as measured from the normal of the plane (or, in your case, trampoline):
http://en.wikipedia.org/wiki/Collision
http://en.wikipedia.org/wiki/Deflection_(physics)

If you make the assumption that you don't have perfectly elastic collisions, you have to do some vector analysis (all while dealing with gravity, as I presume you are).
 
Last edited:
Yes, I agree that a physics forum is probably better for this particular question, since it's basically a physics question. If the OP wants to get into discussing the programming code specifically, the "Programming & Comp Sci" forum would be the place for that.