- Home /
Unity2D - Lerp is rotating in 3D space instead of 2D
I'm sure this has been answered but I have spent hours trying to go through unityAnswers and cannot understand the actual problem.
My Scene: http://screencast.com/t/O7g3Wjzhfq1Q
I want to make the gameObject rotate towards the Station.
Vector3 direction = (station.transform.position-transform.position).normalized;
Debug.Log(direction.x + ", "+direction.y+", "+direction.z);
Debug.Log(transform.rotation.eulerAngles);
Quaternion look = Quaternion.LookRotation(direction);
Debug.Log(look.eulerAngles);
transform.rotation = Quaternion.Lerp(transform.rotation, look, 10*Time.deltaTime);
The results of my Debugs are: 0.9670134, -0.2547254, 0
0.0, 0.0, 0.0
14.8, 90.0, 0.0
When I run, the ship rotates the sprite in 3d space:
http://screencast.com/t/skebDafMpt9C
I tried adding an upaxis vector to LookRotation, but regardless which axis I choose it won't rotate as "expected".
Could someone please explain what I'm missing. What conceptual mistake am I making in understanding how these 2D rotations are supposed to work.
Your answer
![](https://koobas.hobune.stream/wayback/20220613142109im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity 2d - Rigidbody rotation constraints? 4 Answers
In unity 2D c# how to rotate an object like geometry dash? 1 Answer
How can I keep the Ground ALIGNED with the red line in the image below 1 Answer
How can you make a 2D object move based on rotation, and rotate while moving? 1 Answer
Rotate object after swipe according to swipe direction 0 Answers