Question by
alethahmd14 · Aug 12, 2018 at 11:48 AM ·
unity 5lookat
look at local time delay
Hello my friends How to add time delay to look at In this code Thank you very much
{ public GameObject target; public Transform obj; void Start () {
}
// Update is called once per frame
void Update () {
Vector3 lookAtPos = target.transform.position;
//first get a position relative to object
Vector3 lookAtPosLocalised = obj.InverseTransformPoint(target.transform.position);
//offset it
lookAtPosLocalised.y = 0f; //replace zero with any offset needed
//convert localised position back
lookAtPos = obj.TransformPoint(lookAtPosLocalised);
obj.LookAt(lookAtPos);
}
}
Comment
Your answer
Follow this Question
Related Questions
Smooth Look at... 2 Answers
How to use LookAt for only one axis? 1 Answer
setParent. what am i doing wrong? 0 Answers
Unity 5 Scroll View Jitter in iOS 9 0 Answers
Find GameObject with specific type of enum which equals to another enum 0 Answers