public virtual bool IsTeleportWalkableObjectSelected() { QuickUICursor cursor = GetCursor(); QuickUIInteractiveItem selectedItem = cursor? cursor.GetCurrentInteractible() : null; return(selectedItem && (selectedItem.GetComponent <QuickTeleportWalkableObject>() != null)); }
public virtual bool IsNoRayObjectSelected() { QuickUICursor cursor = GetCursor(); if (cursor.GetRaycastResult().collider != null) { return(cursor.GetRaycastResult().collider.gameObject.CompareTag("NoRay")); } return(false); }
public event Action OnTriggerUp; // Called when the trigger assigned to this cursor is released #endregion #region CREATION AND DESTRUCTION public static QuickUICursor CreateVRCursor(Role cType, Transform cTransform) { QuickUICursor vrCursor = cTransform.gameObject.GetOrCreateComponent <QuickUICursor>(); vrCursor._TriggerVirtualKey = InputManager.DEFAULT_BUTTON_CONTINUE; vrCursor._drawRay = (cType == Role.LeftHand || cType == Role.RightHand); _vrCursors[cType] = vrCursor; vrCursor.enabled = false; return(vrCursor); }
protected virtual void CreateVRCursorHand(QuickUICursor.Role cType, Transform tHand, Transform tDistal) { Transform tIntermediate = tDistal.parent; Transform tProximal = tIntermediate.parent; float l1 = Vector3.Distance(tDistal.position, tIntermediate.position); float l2 = Vector3.Distance(tIntermediate.position, tProximal.position); Transform cursorOrigin = tHand.CreateChild("__CursorOrigin__"); cursorOrigin.forward = (tIntermediate.position - tProximal.position).normalized; cursorOrigin.position = tProximal.position + cursorOrigin.forward * (l1 + l2 + (l2 - l1)); QuickUICursor.CreateVRCursor(cType, cursorOrigin); }
protected virtual IEnumerator CoUpdateColor() { yield return(null); while (true) { Color c = IsTeleportWalkableObjectSelected() ? Color.green : Color.red; SetTrajectoryTargetColor(c); QuickUICursor cursor = GetCursor(); if (cursor) { cursor.SetColor(c); } cursor._drawRay = !IsNoRayObjectSelected(); cursor._drawCursor = false; yield return(null); } }
protected virtual void Awake() { if (!Camera.main) { Camera camera = _pfCamera ? Instantiate <Camera>(_pfCamera) : new GameObject().GetOrCreateComponent <Camera>(); camera.name = "__Camera__"; camera.tag = "MainCamera"; camera.gameObject.GetOrCreateComponent <FlareLayer>(); } _camera = Camera.main; _camera.transform.parent = transform; _camera.transform.ResetTransformation(); _camera.GetOrCreateComponent <AudioListener>(); if (!QuickVRManager.IsXREnabled()) { _camera.fieldOfView = 70.0f;//90.0f; } QuickUICursor.CreateVRCursor(QuickUICursor.Role.Head, _camera.transform); }
//protected virtual void UpdateIKTargetPosFromCalibrationPose(QuickVRNode node, HumanBodyBones boneID) //{ // UpdateIKTargetPosFromCalibrationPose(node, boneID, Vector3.one); //} //protected virtual void UpdateIKTargetPosFromCalibrationPose(QuickVRNode node, HumanBodyBones boneID, Vector3 offsetScale) //{ // Transform t = GetIKSolver(boneID)._targetLimb; // Transform calibrationPose = node.GetCalibrationPose(); // if (!t || !calibrationPose) return; // t.localPosition = GetIKSolver(boneID).GetInitialLocalPosTargetLimb(); // Vector3 offset = Vector3.Scale(node.GetTrackedObject().transform.position - calibrationPose.position, offsetScale); // t.position += offset; //} //protected virtual void UpdateIKTargetRotFromCalibrationPose(QuickVRNode node, HumanBodyBones boneID) //{ // Transform t = GetIKSolver(boneID)._targetLimb; // Transform calibrationPose = node.GetCalibrationPose(); // if (!t || !calibrationPose) return; // t.localRotation = GetIKSolver(boneID).GetInitialLocalRotTargetLimb(); // Quaternion rotOffset = node.GetTrackedObject().transform.rotation * Quaternion.Inverse(calibrationPose.rotation); // t.rotation = rotOffset * t.rotation; //} protected virtual void UpdateVRCursors() { QuickUICursor.GetVRCursor(QuickUICursor.Role.LeftHand).transform.position = _animator.GetBoneTransform(HumanBodyBones.LeftIndexDistal).position; QuickUICursor.GetVRCursor(QuickUICursor.Role.RightHand).transform.position = _animator.GetBoneTransform(HumanBodyBones.RightIndexDistal).position; }
protected virtual Vector3 GetPositionEnd() { QuickUICursor cursor = GetCursor(); return(cursor? cursor.GetRaycastResult().point : transform.position); }
protected virtual QuickUICursor GetCursor() { return(QuickUICursor.GetVRCursor(_vrCursorType)); }