Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
Fix positioning after teleport
Browse files Browse the repository at this point in the history
  • Loading branch information
FejZa committed Jun 15, 2020
1 parent 3006e53 commit ee89d8c
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ private Transform GetProxyTransform(Handedness handedness, OculusApi.BoneId bone
private MixedRealityPose GetHandRootPose(Handedness handedness)
{
var playspaceTransform = MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform;
var rootPosition = playspaceTransform.InverseTransformPoint(handState.RootPose.Position.FromFlippedZVector3f());
var rootRotation = Quaternion.Inverse(playspaceTransform.rotation) * handState.RootPose.Orientation.FromFlippedZQuatf();
var rootPosition = playspaceTransform.InverseTransformPoint(playspaceTransform.position + playspaceTransform.rotation * handState.RootPose.Position.FromFlippedZVector3f());
var rootRotation = Quaternion.Inverse(playspaceTransform.rotation) * playspaceTransform.rotation * handState.RootPose.Orientation.FromFlippedZQuatf();

return FixRotation(handedness, new MixedRealityPose(rootPosition + new Vector3(0f, OculusApi.EyeHeight, 0f), rootRotation));
}
Expand All @@ -322,7 +322,7 @@ private MixedRealityPose GetPointerPose(Handedness handedness)
var platformRootPosition = handState.RootPose.Position.FromFlippedZVector3f();

var platformPointerPosition = rootPose.Position + handState.PointerPose.Position.FromFlippedZVector3f() - platformRootPosition;
var platformPointerRotation = Quaternion.Inverse(playspaceTransform.rotation) * handState.PointerPose.Orientation.FromFlippedZQuatf();
var platformPointerRotation = Quaternion.Inverse(playspaceTransform.rotation) * playspaceTransform.rotation * handState.PointerPose.Orientation.FromFlippedZQuatf();

return new MixedRealityPose(platformPointerPosition, platformPointerRotation);
}
Expand Down

0 comments on commit ee89d8c

Please sign in to comment.