Sign in to follow this  
Dtag

Terrain Collision Det.

Recommended Posts

Hi does anyone have some nice links on terrain collision detection? Just placing an object on the top of the terrain and moving it around is not the problem. What Iam asking myself is whats the best way of implementing sliding etc ( in case the position where the player wants to go is too steep for example ). Thanks :)

Share this post


Link to post
Share on other sites
it is not special with terrains, just make coll. detection with the nearest triangles and the ones near it, i mean just a few ones. and make physical movements with interactions. i think, i did not understand what do you want to.

Share this post


Link to post
Share on other sites
If you have the triangle that the player is located over, find the normal of this plane of this triangle. Then take the dot product of that normal with straight up (probably 0, 1, 0) and you'll have the cos of the angle between the triangle and the ground, compare this to whatever angle you want to be the sliding threshold. The way the response changes is the tricky part. When the player isn't sliding, the response is to just move the player up if he is too low. When you want it to slide, you need to find the penetration depth between the player and the triangle it is over. Then move the player's position by the normal of that triangle * the penetration depth.

Share this post


Link to post
Share on other sites
Ah ok thx ;) So it's done with triangles again. I thought there was a special way ( and maybe faster? ) way to do it only with height data.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this