Assets\Scripts\CarController.cs(25,19): ошибка CS1061: "Transform" не содержит определения для "LokAt", и не удалось найти доступный метод расширения "LokAt", принимающий первый аргумент типа "Transform" (вам не хватает директивы using или ссылки на сборку?)
Assets\Scripts\CarController.cs(25,19): error CS1061: 'Transform' does not contain a definition for 'LokAt' and no accessible extension method 'LokAt' accepting a first argument of type 'Transform' could be found (are you missing a using directive or an assembly reference?)
Assets\Scripts\CarController.cs(25,19): error CS1061: 'Transform' does not contain a definition for 'LokAt' and no accessible extension method 'LokAt' accepting a first argument of type 'Transform' could be found (are you missing a using directive or an assembly reference?)
using UnityEngine;
public class CarController : MonoBehaviour
{
private Rigidbody _rb;
public float speed = 5f, finalSpeed = 15f;
private bool isClicked;
public Vector3 FinalPosition;
void Awake() {
_rb = GetComponent<Rigidbody>();
}
void OnMouseDown() {
isClicked = true;
}
void Update() {
if(FinalPosition.x != 0)
transform.position = Vector3.MoveTowards(transform.position, FinalPosition, finalSpeed * Time.deltaTime);
transform.LokAt(FinalPosition);
}
void FixedUpdate() {
if(isClicked && FinalPosition.x == 0)
_rb.MovePosition(transform.position + Vector3.forward * speed * Time.fixedDeltaTime);
}
}