# rolling ball over heightmap

This topic is 4565 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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

##### Share on other sites
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?

##### Share on other sites
ball just change the direction

##### Share on other sites
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.

1. 1
Rutin
45
2. 2
3. 3
4. 4
5. 5
JoeJ
19

• 13
• 10
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632999
• Total Posts
3009812
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!