I am trying to rotate an object to face another in Unity 2D. However i am having some trouble wrapping my head around the way unity uses 2D transformations and most examples I can find are designed for 3D.
Using the code below I can make the object rotate to face the right direction, however it also rotates the object so that it is the Z axis that is pointing towards it. Ideally the object would rotate around the Z axis.
rigidbody2D.transform.LookAt(currentlyTargeted.transform.position);
Any guidance would be much appreciated.
rigidbody2D.transform.LookAt(currentlyTargeted.transform.position, Vector3.up);
– user2779315