Files
modular-vr/Assets/VR/Runtime/Player.cs
2023-05-14 18:13:02 +02:00

30 lines
947 B
C#

using NaughtyAttributes;
using UnityEngine;
namespace EscapeRoomEngine.VR.Runtime
{
/// <summary>
/// The player component contains references to the main camera, eye positions and hand positions of the VR player.
/// </summary>
public class Player : MonoBehaviour
{
/// <summary>
/// The active player instance.
/// </summary>
public static Player Instance { get; private set; }
private void Awake()
{
Instance = this;
}
[BoxGroup("Internal")] public new Camera camera;
[BoxGroup("Internal")] public Transform sphereFollow;
[BoxGroup("Internal")] [SerializeField] private Transform leftEye, rightEye;
[BoxGroup("Internal")] [SerializeField] private Collider leftHand, rightHand;
public Transform GetEye(Camera.StereoscopicEye eye) =>
eye == Camera.StereoscopicEye.Left ? leftEye : rightEye;
}
}