Terrain Collision Det.

Started by
3 comments, last by stroma 19 years, 5 months ago
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 :)
Advertisement
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.
+-+-+-+-+-STR
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.
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.
you can use height data to allow collision detection functions. it will make program a bit faster.
+-+-+-+-+-STR

This topic is closed to new replies.

Advertisement