private void UseOptitrack() { var pos = OptitrackTracker.GetPosition(); var rot = VrTracker.GetRotation(); switch (CurrentMode) { case TrackingMode.Optitrack: ApplyTransform(pos, rot); break; case TrackingMode.ArMarker: CurrentMode = TrackingMode.TransitionToOptitrack; StartAnimations(pos, rot); ApplyTransform(_positionAnimation.CurrentValue, _rotationAnimation.CurrentValue); break; case TrackingMode.TransitionToArMarker: CurrentMode = TrackingMode.TransitionToOptitrack; RestartAnimations(pos, rot); ApplyTransform(_positionAnimation.CurrentValue, _rotationAnimation.CurrentValue); break; case TrackingMode.TransitionToOptitrack: AdjustAnimations(pos, rot); ApplyTransform(_positionAnimation.CurrentValue, _rotationAnimation.CurrentValue); break; } }
private void FixedUpdate() { MarkerTracker.PreparePose(); VrTracker.PreparePose(); OptitrackTracker.PreparePose(); #if UNITY_EDITOR _positionAnimation.AnimationSpeed = SwitchTransitionSpeed; _rotationAnimation.AnimationSpeed = SwitchTransitionSpeed; #endif if (MarkerTracker.HasPose()) { UseArMarkers(); } else { UseOptitrack(); } }