XRoom_Unity/Assets/BNG Framework/Scripts/Components/RotateTowards.cs
2025-05-31 10:20:20 +03:30

15 lines
406 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BNG {
public class RotateTowards : MonoBehaviour {
public Transform TargetTransform;
void Update() {
transform.rotation = Quaternion.LookRotation(Vector3.RotateTowards(transform.right, TargetTransform.position - transform.position, Time.deltaTime * 1f, 0.0f));
}
}
}