A
A
Alex Kolyhov2020-05-13 20:24:24
Unity
Alex Kolyhov, 2020-05-13 20:24:24

Transform.LookAt() doesn't work correctly, why?

Please tell me why this script:

using UnityEngine;

public class RotatePlayer : MonoBehaviour
{
    public Transform target;

    void Update()
    {
        transform.LookAt(target, Vector3.up);
        transform.position = Vector3.Lerp(transform.position, target.position, 0.01f);
    }
}


It works correctly only on simple (standard) Unity models (Cube, sphere, etc.), and on imported models it does not work correctly: the model turns, it teleports somewhere, and when moving the target moves and turns very quickly and chaotically .

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question