public override void OnEnable() { base.OnEnable(); UserPreferences.singleton.headCollider.gameObject.SetActive(false); if (SuperController.singleton.MonitorCenterCamera != null) { var monitorCenterCameraTransform = SuperController.singleton.MonitorCenterCamera.transform; monitorCenterCameraTransform.localEulerAngles = Vector3.zero; } _headControlSnapshot = FreeControllerV3Snapshot.Snap(_headControl); _headControl.canGrabPosition = false; _headControl.canGrabRotation = false; _previousInterpolation = _headControlRB.interpolation; if (!allowPersonHeadRotationJSON.val) { _headControlRB.interpolation = RigidbodyInterpolation.Interpolate; } if (rotationLockJSON.val) { GlobalSceneOptions.singleton.disableNavigation = true; } StartCoroutine(OnEnableCo()); }
public override void OnDisable() { base.OnDisable(); GlobalSceneOptions.singleton.disableNavigation = false; if (_headControlRB != null) { _headControlRB.interpolation = _previousInterpolation; } if (_headControlSnapshot != null) { if (allowPersonHeadRotationJSON.val) { _headControlSnapshot.Restore(false); } else { _headControl.canGrabPosition = _headControlSnapshot.canGrabPosition; _headControl.canGrabRotation = _headControlSnapshot.canGrabRotation; } _headControlSnapshot = null; } _currentPositionVelocity = Vector3.zero; _currentRotationVelocity = Quaternion.identity; UserPreferences.singleton.headCollider.gameObject.SetActive(UserPreferences.singleton.useHeadCollider); }
private void EnableHand(SnugHand hand, string motionControlName) { var motionControl = trackers.motionControls.FirstOrDefault(mc => mc.name == motionControlName); if (motionControl == null || !motionControl.SyncMotionControl()) { return; } hand.motionControl = motionControl; if (trackers.restorePoseAfterPossessJSON.val) { hand.snapshot = FreeControllerV3Snapshot.Snap(hand.controller); } _previousState.Add(new FreeControllerV3GrabSnapshot { controller = hand.controller, canGrabPosition = hand.controller.canGrabPosition, canGrabRotation = hand.controller.canGrabRotation }); hand.active = true; hand.controller.canGrabPosition = false; hand.controller.canGrabRotation = false; hand.controller.possessed = true; (hand.controller.GetComponent <HandControl>() ?? hand.controller.GetComponent <HandControlLink>().handControl).possessed = true; if (previewSnugOffsetJSON.val) { hand.showCueLine = true; } }
public override void Enter() { _leftHandSnapshot = FreeControllerV3Snapshot.Snap(_leftHandControl); _rightHandSnapshot = FreeControllerV3Snapshot.Snap(_rightHandControl); _leftHandControl.RBHoldPositionSpring = 10000; _leftHandControl.RBHoldRotationSpring = 300; _rightHandControl.RBHoldPositionSpring = 10000; _rightHandControl.RBHoldRotationSpring = 300; }
public override void Enter() { _leftHandSnapshot = FreeControllerV3Snapshot.Snap(_leftHandControl); _rightHandSnapshot = FreeControllerV3Snapshot.Snap(_rightHandControl); _leftHandControl.currentPositionState = FreeControllerV3.PositionState.Off; _leftHandControl.currentRotationState = FreeControllerV3.RotationState.Off; _rightHandControl.currentPositionState = FreeControllerV3.PositionState.Off; _rightHandControl.currentRotationState = FreeControllerV3.RotationState.Off; }
private void EnableHand(SnugHand hand, string motionControlName) { var motionControl = context.trackers.motionControls.FirstOrDefault(mc => mc.name == motionControlName); if (motionControl == null) { return; } if (!motionControl.enabled) { return; } if (!motionControl.SyncMotionControl()) { return; } if (!motionControl.controlPosition) { return; } hand.motionControl = motionControl; hand.snapshot = FreeControllerV3Snapshot.Snap(hand.controller); hand.active = true; hand.controller.canGrabPosition = false; hand.controller.canGrabRotation = false; hand.controller.currentPositionState = FreeControllerV3.PositionState.On; if (motionControl.controlRotation) { hand.controller.currentRotationState = FreeControllerV3.RotationState.On; } hand.controller.possessed = true; var mac = hand.controller.GetComponent <MotionAnimationControl>(); if (mac != null) { mac.suspendPositionPlayback = true; if (motionControl.controlRotation) { mac.suspendRotationPlayback = true; } } if (!motionControl.keepCurrentPhysicsHoldStrength) { hand.controller.RBHoldPositionSpring = SuperController.singleton.possessPositionSpring; if (motionControl.controlRotation) { hand.controller.RBHoldRotationSpring = SuperController.singleton.possessRotationSpring; } } if (previewSnugOffsetJSON.val) { hand.showCueLine = true; } }
private bool Bind(MotionControllerWithCustomPossessPoint motionControl) { var controllerWithSnapshot = FindController(motionControl); if (controllerWithSnapshot == null) { return(false); } if (controllerWithSnapshot.active) { return(false); } var controller = controllerWithSnapshot.controller; controller.startedPossess = true; if (motionControl.name == MotionControlNames.Head) { if (motionControl.mappedControllerName == VamConstants.HeadControlName) { // Reduce the stretch between the head and the eye by matching the controller and the head bone controller.control.position = context.bones.First(b => b.name == VamConstants.HeadBoneName).transform.position; AdjustHeadToEyesOffset(); } if (motionControl.currentMotionControl == SuperController.singleton.centerCameraTarget.transform) { UserPreferences.singleton.headCollider.gameObject.SetActive(false); SuperController.singleton.AlignRigAndController(controller, motionControl); } else { SuperController.singleton.AlignTransformAndController(controller, motionControl); } } else { if (motionControl.controlRotation) { controller.control.rotation = motionControl.controllerPointTransform.rotation; } if (motionControl.controlPosition) { controller.control.position = motionControl.controllerPointTransform.position; } } controllerWithSnapshot.active = true; controllerWithSnapshot.snapshot = FreeControllerV3Snapshot.Snap(controller); Possess(motionControl, controller); return(true); }
public override void Enter() { _leftHandSnapshot = FreeControllerV3Snapshot.Snap(_leftHandControl); _rightHandSnapshot = FreeControllerV3Snapshot.Snap(_rightHandControl); _chestSnapshot = FreeControllerV3Snapshot.Snap(_chestControl); _rightHandControl.RBHoldPositionSpring = 10000; _rightHandControl.RBHoldRotationSpring = 300; _leftHandControl.currentPositionState = FreeControllerV3.PositionState.Off; _leftHandControl.currentRotationState = FreeControllerV3.RotationState.Off; _chestControl.currentRotationState = FreeControllerV3.RotationState.On; _chestControl.control.rotation = _headControl.control.rotation; _chestControl.RBHoldRotationSpring = 600; }
public override void OnEnable() { base.OnEnable(); SuperController.singleton.ClearPossess(); foreach (var motionControl in motionControls) { var controllerWithSnapshot = FindController(motionControl); if (controllerWithSnapshot == null) { continue; } var controller = controllerWithSnapshot.controller; if (restorePoseAfterPossessJSON.val) { controllerWithSnapshot.snapshot = FreeControllerV3Snapshot.Snap(controller); } if (motionControl.name == MotionControlNames.Head) { if (motionControl.currentMotionControl == SuperController.singleton.centerCameraTarget.transform) { _navigationRigSnapshot = NavigationRigSnapshot.Snap(); AlignRigAndController(controller, motionControl); } else { var controlRotation = controller.control.rotation; motionControl.currentMotionControl.SetPositionAndRotation( controller.control.position - controlRotation * motionControl.combinedOffset, controlRotation ); } } else { controller.control.SetPositionAndRotation(motionControl.possessPointTransform.position, motionControl.possessPointTransform.rotation); if (controllerWithSnapshot.handControl != null) { controllerWithSnapshot.handControl.possessed = true; } } Possess(motionControl, controllerWithSnapshot.controller); } }
public override void OnEnable() { base.OnEnable(); UserPreferences.singleton.headCollider.gameObject.SetActive(false); _headControlSnapshot = FreeControllerV3Snapshot.Snap(_headControl); _headControl.canGrabPosition = false; _headControl.canGrabRotation = false; _previousInterpolation = _headControlRB.interpolation; _headControlRB.interpolation = RigidbodyInterpolation.Interpolate; if (!allowPersonHeadRotationJSON.val) { GlobalSceneOptions.singleton.disableNavigation = true; } StartCoroutine(OnEnableCo()); }
private void InitDisableSelectionUI() { var disableSelectionJSON = new JSONStorableBool("Make controllers unselectable", false, (bool val) => { if (val) { foreach (var fc in containingAtom.freeControllers) { if (fc == _personLHandController || fc == _personRHandController) { continue; } if (!fc.canGrabPosition && !fc.canGrabRotation) { continue; } if (!fc.name.EndsWith("Control")) { continue; } var state = new FreeControllerV3Snapshot { canGrabPosition = fc.canGrabPosition, canGrabRotation = fc.canGrabRotation }; _previousState[fc] = state; fc.canGrabPosition = false; fc.canGrabRotation = false; } } else { foreach (var kvp in _previousState) { kvp.Key.canGrabPosition = kvp.Value.canGrabPosition; kvp.Key.canGrabRotation = kvp.Value.canGrabRotation; } _previousState.Clear(); } }); CreateToggle(disableSelectionJSON); }
public override void OnDisable() { base.OnDisable(); GlobalSceneOptions.singleton.disableNavigation = false; _navigationRigSnapshot?.Restore(); if (_headRigidbody != null) { _headRigidbody.interpolation = _previousInterpolation; } if (_headControlSnapshot != null) { _headControlSnapshot.Restore(); _headControlSnapshot = null; } _currentPositionVelocity = Vector3.zero; _currentRotationVelocity = Quaternion.identity; }
public override void OnEnable() { base.OnEnable(); _cameraCenter.localPosition = Vector3.zero; _headControlSnapshot = FreeControllerV3Snapshot.Snap(_headControl); _headControl.canGrabPosition = false; _headControl.canGrabRotation = false; _navigationRigSnapshot = NavigationRigSnapshot.Snap(); _previousInterpolation = _headRigidbody.interpolation; _headRigidbody.interpolation = RigidbodyInterpolation.Interpolate; if (!allowPersonHeadRotationJSON.val) { GlobalSceneOptions.singleton.disableNavigation = true; } UpdateNavigationRig(true); }