rolling ball over heightmap

Started by
2 comments, last by PaulEdwards 17 years, 12 months ago
hello, i'm trying to formulate simple physics for rolling ball over heightmap. Ball has mass, speed vector and friction. For each position of ball i can calculate normal vector from heightmap. Any advice or links please? thanks
Advertisement
One basic question that has to be answered: What happens when the ball collides with the terrain? Is the collision elastic, or does the terrain absorb all the momentum perpendicular to it, or does the ball just change direction?
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
ball just change the direction
Although not perfect (innacurate results when a ball is moving horizontally and just grazes a vertical peak in the terrain), you can try this:

On a collision, we'll want to at least cancel out the ball's velocity in the normal's direction. We can do this by doing R = (N dot V) * N where V is the ball's velocity, N is the surface normal and R will be the vector that will cancel out the ball's velocity in the normal's direction.

So. If you want the terrain to absorb all the momentum, then compute V' = V + R where V' is the ball's new velocity.

If you want a perfectly elastic collision, do V' = V + 2*R.

If you want something in between, you can do V' = V + (1 + a)*R, where 0 <= a <= 1 and a represents how elastic you want the collision to be.


Alright, 24's on, hope this helps, gotta go.
Andrew

This topic is closed to new replies.

Advertisement