Files
Slendytubbies-V2-Beta/V2Beta/Assets/Plugins/Assembly-UnityScript-firstpass/SmoothLookAt.cs
T
2026-05-24 12:14:04 +02:00

51 lines
858 B
C#

using System;
using UnityEngine;
[Serializable]
[AddComponentMenu("Camera-Control/Smooth Look At")]
public class SmoothLookAt : MonoBehaviour
{
public Transform target;
public float damping;
public bool smooth;
public SmoothLookAt()
{
damping = 6f;
smooth = true;
}
public virtual void LateUpdate()
{
if (GetComponent<NetworkView>().isMine)
{
}
if ((bool)target)
{
if (smooth)
{
Quaternion to = Quaternion.LookRotation(target.position - transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, to, Time.deltaTime * damping);
}
else
{
transform.LookAt(target);
}
}
}
public virtual void Start()
{
if (GetComponent<NetworkView>().isMine && (bool)GetComponent<Rigidbody>())
{
GetComponent<Rigidbody>().freezeRotation = true;
}
}
public virtual void Main()
{
}
}