Skip to content

Commit

Permalink
Comment fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Zee2 committed Oct 13, 2022
1 parent 95eec44 commit 76e2df0
Showing 1 changed file with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,8 @@ protected override void OnSelectExited(SelectExitEventArgs args)
private static readonly ProfilerMarker ObjectManipulatorProcessInteractableMarker =
new ProfilerMarker("[MRTK] ObjectManipulator.ProcessInteractable");

private MixedRealityTransform lastFrameInput;

///<inheritdoc />
public override void ProcessInteractable(XRInteractionUpdateOrder.UpdatePhase updatePhase)
{
Expand All @@ -611,36 +613,38 @@ public override void ProcessInteractable(XRInteractionUpdateOrder.UpdatePhase up
{
if (allowedManipulations.IsMaskSet(TransformFlags.Scale))
{
targetTransform.Scale = ManipulationLogic.scaleLogic.Update(interactorsSelecting, this, targetTransform, useCenteredAnchor);
targetTransform.Scale = ManipulationLogic.scaleLogic.Update(interactorsSelecting, this, lastFrameInput, useCenteredAnchor);
}
}

// Immediately apply scale constraints after computing the user's desired scale input.
if (EnableConstraints && constraintsManager != null)
using (RotateLogicMarker.Auto())
{
constraintsManager.ApplyScaleConstraints(ref targetTransform, isOneHanded, IsGrabSelected);
if (allowedManipulations.IsMaskSet(TransformFlags.Rotate))
{
targetTransform.Rotation = ManipulationLogic.rotateLogic.Update(interactorsSelecting, this, lastFrameInput, useCenteredAnchor);
}
}

using (RotateLogicMarker.Auto())
using (MoveLogicMarker.Auto())
{
if (allowedManipulations.IsMaskSet(TransformFlags.Rotate))
if (allowedManipulations.IsMaskSet(TransformFlags.Move))
{
targetTransform.Rotation = ManipulationLogic.rotateLogic.Update(interactorsSelecting, this, targetTransform, useCenteredAnchor);
targetTransform.Position = ManipulationLogic.moveLogic.Update(interactorsSelecting, this, lastFrameInput, useCenteredAnchor);
}
}

// Immediately apply rotation constraints after computing the user's desired rotation input.
lastFrameInput = targetTransform;

// Immediately apply scale constraints after computing the user's desired scale input.
if (EnableConstraints && constraintsManager != null)
{
constraintsManager.ApplyRotationConstraints(ref targetTransform, isOneHanded, IsGrabSelected);
constraintsManager.ApplyScaleConstraints(ref targetTransform, isOneHanded, IsGrabSelected);
}

using (MoveLogicMarker.Auto())
// Immediately apply rotation constraints after computing the user's desired rotation input.
if (EnableConstraints && constraintsManager != null)
{
if (allowedManipulations.IsMaskSet(TransformFlags.Move))
{
targetTransform.Position = ManipulationLogic.moveLogic.Update(interactorsSelecting, this, targetTransform, useCenteredAnchor);
}
constraintsManager.ApplyRotationConstraints(ref targetTransform, isOneHanded, IsGrabSelected);
}

// Immediately apply translation constraints after computing the user's desired scale input.
Expand Down Expand Up @@ -709,7 +713,7 @@ private void ApplyTargetPose(MixedRealityTransform targetPose)
/// own modifications to the object's pose.
/// </summary>
/// <param name="targetPose">
/// The target position, rotation, and scale, pre-smoothing/constraints/etc. Modified by-reference.
/// The target position, rotation, and scale, pre-smoothing. Modified by-reference.
/// <param/>
/// <param name="modifiedTransformFlags">
/// Flags which parts of the transform (position, rotation, scale) have been altered by an external source (like Elastics).
Expand Down

0 comments on commit 76e2df0

Please sign in to comment.