How to make the front, left, right, or the back of a gameobject look at a target?
I have a gameobject that i have rotating around a target and i would like for the gameobject to face the direction of movement by making the left or right of the gameobject face the target when moving.
I have :
transform.LookAt(target.trasform.position);
to face the target and i found:
transform.rotation = Quaternion.LookRotation(transform.position - target.transform.position)
to face away from the target. Is there a way I can have the left and right sides of my gameobject face the target?
Answer by Fattie · Dec 18, 2015 at 08:16 PM
If you're a beginner, perhaps the easiest ways to do this is:
make it look at the target
make it turn 90 degrees left or right, as you need
really that's the best way .. do it in two steps!
Hope it helps
Your answer
Follow this Question
Related Questions
Problem with Quaternion and Euler Angles 0 Answers
Delayed LookAt, but only on one axis 1 Answer
endless runner rotating 0 Answers
Rotation issues - Please help 0 Answers
How to make player move along x axis? 0 Answers