You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
886 B
C#

1 week ago
using Cinemachine;
using UnityEngine;
using UnityEngine.Assertions;
namespace Unity.BossRoom.CameraUtils
{
public class CameraController : MonoBehaviour
{
private CinemachineFreeLook m_MainCamera;
void Start()
{
AttachCamera();
}
private void AttachCamera()
{
m_MainCamera = GameObject.FindObjectOfType<CinemachineFreeLook>();
Assert.IsNotNull(m_MainCamera, "CameraController.AttachCamera: Couldn't find gameplay freelook camera");
if (m_MainCamera)
{
// camera body / aim
m_MainCamera.Follow = transform;
m_MainCamera.LookAt = transform;
// default rotation / zoom
m_MainCamera.m_Heading.m_Bias = 40f;
m_MainCamera.m_YAxis.Value = 0.5f;
}
}
}
}