rabidus-test/Assets/BNG Framework/Scripts/Components/RotateTowards.cs

15 lines
406 B
C#
Raw Permalink Normal View History

2023-07-24 16:38:13 +03:00
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));
}
}
}