- Home /
Question by
haliodoha7 · Oct 11, 2020 at 12:47 PM ·
2drotationvector
Z Axis look at another object direction
Hi I have two objects, one in the middle and one is far little bit I want the one that is far to be looking at the one in the middle by Z Axis
untitled.png
(113.3 kB)
Comment
Best Answer
Answer by haliodoha7 · Oct 11, 2020 at 12:49 PM
Solved by me:
Vector3 direction = target.position - transform.position;
Quaternion rotation = Quaternion.lookRotation(direction);
transform.rotation = rotation;
Your answer
Follow this Question
Related Questions
Vector rotation 1 Answer
Basic 2D movement C# - Key presses cancel eachother out 4 Answers
Making sprites just rotate and not tilt. 3 Answers
Angle to Rotation 2 Answers