How to get the direction based on rotation
Hey, what i am trying to do is to get the direction based on rotation. because i want to know if he is facing front , back, left and right. In my script i have this to round the rotation. Vector3 vec = transform.eulerAngles; vec.y = Mathf.Round(vec.y / 90) * 90; transform.eulerAngles = vec;
I want this because what my script does is move only in 4 direction when player is pushing a box.
Player = Red ball
when my player is facing front when he pushes W he displays an image walk in front but when pushes S display an animation pulling back. So if he is facing back it inverts. Same for left and right, but i cant figure out how to do this.
Thanks in advance.
Your answer
Follow this Question
Related Questions
How to lock X rotation on 3D object? 0 Answers
3D Top Down shooter mouse follow inaccurate at some angles 0 Answers
Rotate Rigidbody towards target rotation using AddTorque() 0 Answers
Help with player rotation on rotating sphere 1 Answer
How can I incorporate a Rotation Towards the Mouse Position into this Script? I Tried. 0 Answers