proto_racer/Assets/Scripts/Follow.cs

22 lines
372 B
C#

using UnityEngine;
public class Follow : MonoBehaviour
{
public Transform target;
public Vector3 offset;
private Transform _transform;
private void Awake()
{
_transform = transform;
}
private void Update()
{
_transform.position = target.position + offset;
_transform.rotation = target.rotation;
}
}