hillclimb2d/Assets/Scripts/Follow.cs
2025-03-16 20:03:45 +05:30

20 lines
428 B
C#

using UnityEngine;
public class Follow : MonoBehaviour
{
public Transform target;
private Vector3 offset;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
offset = transform.position - target.position;
}
// Update is called once per frame
void Update()
{
transform.position = target.position + offset;
}
}