- Home /
Measure 'Steepness' of Normal
Hi, all!
I have a player that follows the normal of the faces he is traveling on over rolling hills and such, and I want to slow him down when going uphill and speed home up when going downhill. I'm trying to figure out an algorithm using the normal of the face he is standing on to calculate an appropriate movement speed on the x axis (this game is 2D). However, I cannot seem to wrap my brain around what is returned by RayCastHit.normal... I know what a normal is and how to use them, but I can't figure out how to retrieve or simply understand the steepness of a normal. Any help you could offer would be much appreciated.
Thanks!- ya
Answer by flaviusxvii · Aug 06, 2014 at 02:58 PM
You can get the angle between the normal and Vector3.up. The closer to ZERO, the flatter it is. 90 degrees would be a sheer vertical. Greater than 90 would be overhang.
This works really well for me, but I need a way to tell if it is a negative or positive angle. Any ideas?
Your answer
![](https://koobas.hobune.stream/wayback/20220613155958im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Get Player to 'Stick' to Surface 0 Answers
Up for a challenge? 3 Answers
How to draw a line between objects and get distance 1 Answer