Skip to content

Commit

Permalink
Merge pull request #1566 from WEKIT-ECS/ashubin/ghost_rotation_fix
Browse files Browse the repository at this point in the history
ghost rotation fix
  • Loading branch information
cawke authored Sep 20, 2023
2 parents 26c5952 + ef92906 commit a56d703
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private static Pose CreateLocalPose(Transform anchor, Vector3 position, Quaterni
return new Pose
{
position = anchor.InverseTransformPoint(position),
rotation = Quaternion.Inverse(anchor.parent.localRotation) * rotation,
rotation = Quaternion.Inverse(anchor.localRotation) * rotation,
};
}

Expand Down
16 changes: 11 additions & 5 deletions Assets/MirageXR/Common/Scripts/Grid/ManipulationController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,12 @@ private void OnManipulationUpdated(GameObject source)
return;
}

UpdateCopyPosition(source);
SnapToGrid(_copy);
UpdateGridLines(_copy);
if (_copy)
{
UpdateCopyPosition(source);
SnapToGrid(_copy);
UpdateGridLines(_copy);
}
}

private void OnManipulationEnded(GameObject source)
Expand Down Expand Up @@ -276,8 +279,11 @@ private void HideGridLines()

private void UpdateCopyPosition(GameObject source)
{
_copy.SetPose(source.GetPose());
_copy.transform.localScale = source.transform.lossyScale;
if (_copy)
{
_copy.SetPose(source.GetPose());
_copy.transform.localScale = source.transform.lossyScale;
}
}

private void HideCopy()
Expand Down

0 comments on commit a56d703

Please sign in to comment.