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

Commit

Permalink
used camera parent transform instead of querying for camera system pl…
Browse files Browse the repository at this point in the history
…ayspace
  • Loading branch information
StephenHodgson committed Apr 23, 2020
1 parent 70a5317 commit d5bd383
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,10 @@ private void ProcessTeleportationRequest(TeleportEventData eventData)
: MixedRealityToolkit.CameraSystem.MainCameraRig.CameraTransform;
var cameraPosition = cameraTransform.position;
var cameraParent = cameraTransform.parent;
var parentPosition = cameraParent.position;
Debug.Assert(cameraParent != null, "The Teleport System requires that the camera be parented under another object.");
var height = targetPosition.y;

if (MixedRealityToolkit.CameraSystem != null)
{
height += MixedRealityToolkit.CameraSystem.MainCameraRig.PlayspaceTransform.position.y;
}

targetPosition -= cameraPosition - cameraParent.position;
var height = targetPosition.y + parentPosition.y;
targetPosition -= cameraPosition - parentPosition;
targetPosition.y = height;
cameraParent.position = targetPosition;
cameraParent.RotateAround(cameraPosition, Vector3.up, targetRotation.y - cameraTransform.eulerAngles.y);
Expand Down

0 comments on commit d5bd383

Please sign in to comment.