Files
LowPolyRPG/Assets/Plugins/RaycastPro/_Demo/_Scripts/FollowTarget.cs

16 lines
399 B
C#
Raw Normal View History

2025-06-25 11:10:11 +01:00
using UnityEngine;
namespace Plugins.RaycastPro.Demo.Scripts
{
public class FollowTarget : MonoBehaviour
{
[SerializeField] private Rigidbody _rigidbody;
public Transform target;
[SerializeField] private float speed;
void Update()
{
_rigidbody.linearVelocity = (target.position - transform.position).normalized * speed;
}
}
}