r2mods/ilspy_dump/ror2_csproj/ScaledCamera.cs

30 lines
516 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using UnityEngine;
public class ScaledCamera : MonoBehaviour
{
public float scale = 1f;
private bool foundCamera;
private Vector3 offset;
private void Start()
{
}
private void LateUpdate()
{
Camera main = Camera.main;
if (main != null)
{
if (!foundCamera)
{
foundCamera = true;
offset = main.transform.position - base.transform.position;
}
base.transform.eulerAngles = main.transform.eulerAngles;
base.transform.position = main.transform.position / scale - offset;
}
}
}