private void MigrateOneHandRotationModes(ref ObjectManipulator objManip, ManipulationHandler.RotateInOneHandType oldMode, ManipulationProximityFlags proximity) { ObjectManipulator.RotateInOneHandType newMode = ObjectManipulator.RotateInOneHandType.RotateAboutGrabPoint; switch (oldMode) { case ManipulationHandler.RotateInOneHandType.MaintainRotationToUser: { newMode = ObjectManipulator.RotateInOneHandType.RotateAboutGrabPoint; var constraint = objManip.EnsureComponent <FixedRotationToUserConstraint>(); constraint.TargetTransform = objManip.HostTransform; constraint.HandType = ManipulationHandFlags.OneHanded; constraint.ProximityType = proximity; break; } case ManipulationHandler.RotateInOneHandType.GravityAlignedMaintainRotationToUser: { newMode = ObjectManipulator.RotateInOneHandType.RotateAboutGrabPoint; var rotConstraint = objManip.EnsureComponent <FixedRotationToUserConstraint>(); rotConstraint.TargetTransform = objManip.HostTransform; rotConstraint.HandType = ManipulationHandFlags.OneHanded; rotConstraint.ProximityType = proximity; var axisConstraint = objManip.EnsureComponent <RotationAxisConstraint>(); axisConstraint.TargetTransform = objManip.HostTransform; axisConstraint.HandType = ManipulationHandFlags.OneHanded; axisConstraint.ProximityType = proximity; axisConstraint.ConstraintOnRotation = AxisFlags.XAxis | AxisFlags.ZAxis; break; } case ManipulationHandler.RotateInOneHandType.FaceUser: { newMode = ObjectManipulator.RotateInOneHandType.RotateAboutGrabPoint; var rotConstraint = objManip.EnsureComponent <FaceUserConstraint>(); rotConstraint.TargetTransform = objManip.HostTransform; rotConstraint.HandType = ManipulationHandFlags.OneHanded; rotConstraint.ProximityType = proximity; rotConstraint.FaceAway = false; break; } case ManipulationHandler.RotateInOneHandType.FaceAwayFromUser: { newMode = ObjectManipulator.RotateInOneHandType.RotateAboutGrabPoint; var rotConstraint = objManip.EnsureComponent <FaceUserConstraint>(); rotConstraint.TargetTransform = objManip.HostTransform; rotConstraint.HandType = ManipulationHandFlags.OneHanded; rotConstraint.ProximityType = proximity; rotConstraint.FaceAway = true; break; } case ManipulationHandler.RotateInOneHandType.MaintainOriginalRotation: { newMode = ObjectManipulator.RotateInOneHandType.RotateAboutGrabPoint; var rotConstraint = objManip.EnsureComponent <FixedRotationToWorldConstraint>(); rotConstraint.TargetTransform = objManip.HostTransform; rotConstraint.HandType = ManipulationHandFlags.OneHanded; rotConstraint.ProximityType = proximity; break; } case ManipulationHandler.RotateInOneHandType.RotateAboutObjectCenter: newMode = ObjectManipulator.RotateInOneHandType.RotateAboutObjectCenter; break; case ManipulationHandler.RotateInOneHandType.RotateAboutGrabPoint: newMode = ObjectManipulator.RotateInOneHandType.RotateAboutGrabPoint; break; } if (proximity.HasFlag(ManipulationProximityFlags.Near)) { objManip.OneHandRotationModeNear = newMode; } if (proximity.HasFlag(ManipulationProximityFlags.Far)) { objManip.OneHandRotationModeFar = newMode; } }