• Advertisement
Sign in to follow this  

Terrain Angle Check.

This topic is 4803 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

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.

Share this post


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

Share this post


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

Share this post


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

  • Advertisement