protected virtual void Update() { if (!_canvas.worldCamera) { _canvas.worldCamera = QuickVRCameraController.GetCamera(); } }
protected virtual Ray ComputeRay() { if (!QuickVRManager.IsXREnabled() && GetVRCursor(Role.Head) == this) { return(QuickVRCameraController.GetCamera().ScreenPointToRay(new Vector3(_mouse.position.x.ReadValue(), _mouse.position.y.ReadValue()))); } return(new Ray(transform.position, _CursorTransform.position - transform.position)); }
public virtual void ResetPosition() { Animator animator = QuickSingletonManager.GetInstance <QuickVRManager>().GetAnimatorTarget(); //Vector3 fwd = animator.transform.forward; Vector3 fwd = Vector3.ProjectOnPlane(QuickVRCameraController.GetCamera().transform.forward, animator.transform.up); transform.position = animator.GetBoneTransform(HumanBodyBones.Head).position + fwd * 3; transform.forward = fwd; }
protected new void Start() { Camera cam = QuickVRCameraController.GetCamera(); cameraGameObject = cam.gameObject; cameraFloorOffsetObject = cam.transform.parent.gameObject; if (!rig) { rig = gameObject; } }
protected static void Init() { Camera tmpCamera = Camera.main; QuickVRCameraController cameraController = QuickSingletonManager.GetInstance <QuickVRCameraController>(); QuickWebXRCamera wxrCameras = cameraController.transform.CreateChild("WebXRCameras").GetOrCreateComponent <QuickWebXRCamera>(); if (tmpCamera) { wxrCameras.transform.position = tmpCamera.transform.position; wxrCameras.transform.forward = tmpCamera.transform.forward; tmpCamera.gameObject.SetActive(false); } }
protected virtual void Awake() { Reset(); _vrPlayArea = QuickSingletonManager.GetInstance <QuickVRPlayArea>(); _cameraController = QuickSingletonManager.GetInstance <QuickVRCameraController>(); _inputManager = QuickSingletonManager.GetInstance <InputManager>(); _fpsCounter = QuickSingletonManager.GetInstance <PerformanceFPS>(); _copyPose = gameObject.GetOrCreateComponent <QuickCopyPoseBase>(); //_copyPose = gameObject.GetOrCreateComponent<QuickCopyPoseDirect>(); _copyPose.enabled = false; //Legacy XR Mode is deprecated on 2020 onwards. #if UNITY_2020_1_OR_NEWER _XRMode = XRMode.XRPlugin; #endif }
protected virtual void Awake() { _vrManager = QuickSingletonManager.GetInstance <QuickVRManager>(); QuickVRCameraController cameraController = QuickSingletonManager.GetInstance <QuickVRCameraController>(); cameraController._visibleLayers &= ~(1 << (int)LayerMask.NameToLayer("Hair")); _animator = GetComponent <Animator>(); Renderer[] renderers = GetComponentsInChildren <Renderer>(); foreach (Renderer r in renderers) { if (r.name == "Hair") { _hairRenderer = r; break; } } }
protected virtual void OnEndMove(LocomotionSystem lSystem) { Animator animator = _vrManager.GetAnimatorTarget(); Camera cam = QuickVRCameraController.GetCamera(); if (animator && cam) { QuickVRPlayArea playArea = QuickSingletonManager.GetInstance <QuickVRPlayArea>(); Transform tmp = playArea.transform.parent; playArea.transform.parent = null; Vector3 fwd = animator.transform.forward; Vector3 rotAxis = animator.transform.up; Vector3 targetFwd = Vector3.ProjectOnPlane(cam.transform.forward, rotAxis); animator.GetBoneTransform(HumanBodyBones.Head).Rotate(rotAxis, Vector3.SignedAngle(targetFwd, fwd, rotAxis), Space.World); animator.transform.forward = targetFwd; playArea.transform.parent = tmp; } }