Skip to main content
GameDev.net gamedev.net
🔒 Locked

Terrain Angle Check.

Started by X5-Programmer Jan 2, 2005 at 1:32 PM 1 replies 600+ views
Original Post
X5-Programmer
X5-Programmer
Hi there, I have an question about checking if an point is more then 60+ degrees lyeing on an 3dterrain, if so return true or else false. I will try to use this for my game so I can't clamb high mountain/hills. Any solutions how to do this? Thanks.
-[ thx ]-
Ilici
Ilici
Find the normal of the terrain under that point.

Then check if

n.y / sqrt(n.x^2 + n.z^2) > tan60

Basically that is the tangent of the angle of the normal with the horizontal.
OrenGL
OrenGL
Notice that a point is not going to have a direction on a terrain. You can allways look at it from a lot of diffrent directions giveing it a diffrent angle.

What you need is where the character is and where he is trying to go; a point and a direction. Then you can add the length of the movment to the point and find out what that height will be at that point. Useing the two heights you can find out what the angle is.
Don't shoot! I'm with the science team.....

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.