- #1
StefenRoebke
- 12
- 0
I am working on a simulation of a ball moving in a complex 2d environment. I am looking for a single physics model that will handle the movement of the ball properly. Here is exactly what I have:
Gravity applied in the -y direction
Friction and wind resistance
collision detection with the environment.
The environment consists of many walls, as well as ramps of varying angles, and eventuually some more complex structures.
The issue I am running into is mainly as follows:
When should the ball bounce of a surface it collides with, and when should it roll along it?
Say the ball is moving along a floor parallel to the x axis. It comes across a ramp of 45 degrees. Does it roll up it? Does it bounce off? What about 20 degrees? What about 80 degrees?
What if the ball is in free fall and it hits a ramp. Does it bounce off the ramp? Does it roll down the ramp?
Everything I know about physics tells me there should be a single mathematical model that handles this, and I don't need a lot of checks in the simulation code for the state of the ball, but I am at a loss. Any advice, help, resources, or just a push in the right direction would be much appreciated!
Gravity applied in the -y direction
Friction and wind resistance
collision detection with the environment.
The environment consists of many walls, as well as ramps of varying angles, and eventuually some more complex structures.
The issue I am running into is mainly as follows:
When should the ball bounce of a surface it collides with, and when should it roll along it?
Say the ball is moving along a floor parallel to the x axis. It comes across a ramp of 45 degrees. Does it roll up it? Does it bounce off? What about 20 degrees? What about 80 degrees?
What if the ball is in free fall and it hits a ramp. Does it bounce off the ramp? Does it roll down the ramp?
Everything I know about physics tells me there should be a single mathematical model that handles this, and I don't need a lot of checks in the simulation code for the state of the ball, but I am at a loss. Any advice, help, resources, or just a push in the right direction would be much appreciated!