Make object always face and rotate to another object
As title , I want to make object always face and rotate to another object when target is rotating.
Answer by edallison · Oct 15, 2016 at 09:16 PM
If I understand your question correctly I think I've had a similar problem. A solution I've found is to have a parent structure something like BoxGroupWrapper -> BoxGroup -> Box.
Apply a script to BoxGroup that makes it rotate:
void Update () {
transform.Rotate (new Vector3 (0, 0, 45) * Time.deltaTime);
}
Then apply a script to BoxGroupWrapper that makes it always face the object you'd like (In this case the camera):
void Update () {
transform.LookAt(Camera.main.transform.position, -Vector3.up);
}
Hope this helps!
Thanks! But I've solved the question several days ago.
Your answer
Follow this Question
Related Questions
using LookAt(), transform.forward but move only in X axis 0 Answers
Optimization question: facing rotation 0 Answers
LookAt doesnt work 1 Answer
rotate enemy toward player over time 0 Answers
transform.lookAt not working as intended 0 Answers