Jump to content
  • Advertisement
Sign in to follow this  
libor capak

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
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?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

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!