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

  • Context: Undergrad 
  • Thread starter Thread starter Subliminalman
  • Start date Start date
  • Tags Tags
    Trampoline
Click For Summary
SUMMARY

The discussion focuses on implementing trampoline physics in a video game featuring a falling cat. The proposed code snippet utilizes basic trigonometric functions to calculate the character's velocity based on the trampoline's angle, using the equations character.velocity.Y = 10 * (float)Math.Sin(trampRotation) and character.velocity.X = 10 * (float)Math.Cos(trampRotation). It is suggested that the bounce can be modeled as an elastic collision, where the angle of incidence equals the angle of reflection. For more complex scenarios, vector analysis is recommended to account for gravity and inelastic collisions.

PREREQUISITES
  • Understanding of basic physics principles, specifically elastic collisions
  • Familiarity with trigonometric functions in programming
  • Knowledge of vector analysis in game physics
  • Experience with game development frameworks (e.g., Unity or Unreal Engine)
NEXT STEPS
  • Research "Elastic Collision Physics" to understand the principles of bounce dynamics
  • Explore "Vector Analysis in Game Physics" for advanced collision modeling
  • Learn about "Trigonometric Functions in C#" for better implementation in game code
  • Investigate "Gravity Effects in Game Development" to enhance realism in falling mechanics
USEFUL FOR

Game developers, physics enthusiasts, and programmers looking to implement realistic bounce mechanics in video games.

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

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
8K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 39 ·
2
Replies
39
Views
5K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 32 ·
2
Replies
32
Views
10K
Replies
5
Views
4K
  • · Replies 4 ·
Replies
4
Views
4K
Replies
8
Views
2K