21 lines
339 B
C#
21 lines
339 B
C#
using UnityEngine;
|
|
|
|
public class FollowTransform : MonoBehaviour
|
|
{
|
|
public Transform targetTransform;
|
|
|
|
public bool faceForward;
|
|
|
|
private void Update()
|
|
{
|
|
if (targetTransform != null)
|
|
{
|
|
base.transform.position = targetTransform.position;
|
|
if (faceForward)
|
|
{
|
|
base.transform.forward = targetTransform.forward;
|
|
}
|
|
}
|
|
}
|
|
}
|