mixedreality/com.microsoft.mixedreality..../SDK/Features/Input/Handlers/Constraints/FixedRotationToWorldConstra...

31 lines
875 B
C#

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using Microsoft.MixedReality.Toolkit.Utilities;
namespace Microsoft.MixedReality.Toolkit.UI
{
/// <summary>
/// Component for fixing the rotation of a manipulated object relative to the world
/// </summary>
public class FixedRotationToWorldConstraint : TransformConstraint
{
#region Properties
public override TransformFlags ConstraintType => TransformFlags.Rotate;
#endregion Properties
#region Public Methods
/// <summary>
/// Fix rotation to the rotation from manipulation start
/// </summary>
public override void ApplyConstraint(ref MixedRealityTransform transform)
{
transform.Rotation = this.worldPoseOnManipulationStart.Rotation;
}
#endregion Public Methods
}
}