22 lines
527 B
C#
22 lines
527 B
C#
using Cinemachine;
|
|
using UnityEngine;
|
|
|
|
public class UnderwaterVCam : MonoBehaviour
|
|
{
|
|
private CinemachineVirtualCamera vcam;
|
|
|
|
private void Start()
|
|
{
|
|
vcam = GetComponent<CinemachineVirtualCamera>();
|
|
AttachmentBody[] array = Object.FindObjectsByType<AttachmentBody>(FindObjectsInactive.Exclude, FindObjectsSortMode.None);
|
|
foreach (AttachmentBody attachmentBody in array)
|
|
{
|
|
if (attachmentBody.IsHeadingAttach)
|
|
{
|
|
vcam.Follow = attachmentBody.transform;
|
|
vcam.LookAt = attachmentBody.transform;
|
|
}
|
|
}
|
|
}
|
|
}
|