using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.InputSystem.XR; using WCQ.CommonV1_20200325; [DefaultExecutionOrder(100000)] public class SetUpSVRForXR : MonoBehaviour { [SerializeField] private Camera XRCamera; [SerializeField] private ControllerInputFromAction left; [SerializeField] private ControllerInputFromAction right; private SvrManager svr { get { return SvrManager.Instance; } } private SC.InputSystem.InputSystem inputsystem { get { return SC.InputSystem.InputSystem.Instant; } } AddOnCamera addonCamera; private void Awake() { //DontDestroyOnLoad(gameObject); DebugMy.Log("SetUpSVR Awake", this, true); if ( XRCamera == null ) { DebugMy.LogError("Please Set XRCamera", this); } if ( svr != null ) { svr.gameObject.SetActive(false); svr.status.running = true; DebugMy.Log("SetUpSVR Finish", this, true); addonCamera = XRCamera.gameObject.AddComponent(); return; } DebugMy.Log("SetUpSVR Failed", this, true); } private void LateUpdate() { // DebugMy.isShowNormalLog = true; //for sync headpose from xr if ( XRCamera && svr != null ) { if (Application.platform == RuntimePlatform.Android) { // svr.head.position = XRCamera.transform.position; // svr.head.rotation = XRCamera.transform.rotation; } } else { //DebugMy.Log("Cannot sync headpose from xr !", this, true); } //if (addonCamera ) //{ // addonCamera.LeftController = left.Controller; // addonCamera.LeftControllerRotation = left.controllerRotation; //} //if (addonCamera) //{ // addonCamera.RightController = right.Controller; // addonCamera.RightControllerRotation = right.controllerRotation; //} } }