- Home /
Navmesh get rotation
I am trying to implement Navmesh and Mecanim into one system but I came across a problem. I want the Nav mesh agent to play a rotation animation while he walks but I don't know how to obtain the rotational information from the Navmesh Agent component.
Is there a float where the rotation of the player gets stored?
Rotation is stored in the Transform
component. Pathfinding has nothing to do with rotation. It is purely positional.
Do you know how I could store if the object is turning left or right ?
a variable that is either 1 or -1. 1 for clockwise and -1 for anti-clockwise. These values help when doing math for rotation :)
but how do I call for it ? $$anonymous$$ore specifically what function?
I don't think that's a build in function. Simply store your previous rotation value, then subtract your current rotation by the previous rotation. If the value is positive then you'r going clockwise, if it's negative you're going anti-clockwise.
Answer by justinl · Jul 09, 2013 at 11:09 PM
To determine left/right turn movement, simply store your previous rotation value, then subtract your current rotation by the previous rotation. If the value is positive then you'r going clockwise, if it's negative you're going anti-clockwise.
Your answer
![](https://koobas.hobune.stream/wayback/20220613105727im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
PhotonNetwork.IsClient, how to set tags for players? 2 Answers
NavAgent not following on rebuilt NavMesh 0 Answers
NavMesh Modifier not changing navmesh 2 Answers
Enable/Disable the NavmeshAgent programatically? 2 Answers
Navmesh agent forward movement 1 Answer