This commit is contained in:
2025-11-20 12:06:42 +08:00
parent 388fbe743e
commit 7936419eec
566 changed files with 130934 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
using UnityEngine;
public class PointAtAimTarget : MonoBehaviour
{
[Tooltip("This object represents the aim target. We always point toeards this")]
public Transform AimTarget;
void Update()
{
// Aim at the aim target
if (AimTarget == null)
return;
var dir = AimTarget.position - transform.position;
if (dir.sqrMagnitude > 0.01f)
transform.rotation = Quaternion.LookRotation(dir);
}
}