Skip to content

Fix XrNavigation teleport offset#8409

Merged
willeastcott merged 1 commit into
mainfrom
fix-xr-navigation-teleport-offset
Jan 25, 2026
Merged

Fix XrNavigation teleport offset#8409
willeastcott merged 1 commit into
mainfrom
fix-xr-navigation-teleport-offset

Conversation

@willeastcott

@willeastcott willeastcott commented Jan 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fixes XrNavigation teleport landing short of the target position by accounting for the camera's local XZ offset from XR head tracking

Technical Details

In WebXR, the camera entity's local position represents the user's physical head position within their play space. The previous code moved the navigation entity directly to the hit point without compensating for this offset, causing the camera to end up at hitPoint + cameraLocalOffset instead of directly above hitPoint.

The fix subtracts the camera's local XZ position from the hit point before setting the navigation entity position.

Test Plan

  • Run the XR Menu example in VR
  • Point at a spot on the ground and teleport
  • Verify the camera ends up directly above the target location

Closes #8408

The teleport feature was moving the navigation entity directly to the
hit point without compensating for the camera's local XZ offset from
XR head tracking. This caused the user to land short of the target.

Now subtracts the camera's local XZ position from the hit point before
setting the navigation entity position, so the user's head ends up
directly above where they were pointing.

Fixes #8408

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a teleportation offset bug in the XrNavigation script where users would land short of their intended target position. The fix accounts for the camera's local XZ offset from XR head tracking by subtracting it from the hit point before positioning the navigation entity.

Changes:

  • Added camera local position offset adjustment to teleportation logic to ensure the camera ends up directly above the target location

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@willeastcott willeastcott merged commit 07f2e38 into main Jan 25, 2026
13 checks passed
@willeastcott willeastcott deleted the fix-xr-navigation-teleport-offset branch January 25, 2026 23:55
willeastcott added a commit that referenced this pull request Jan 26, 2026
The teleport feature was moving the navigation entity directly to the
hit point without compensating for the camera's local XZ offset from
XR head tracking. This caused the user to land short of the target.

Now subtracts the camera's local XZ position from the hit point before
setting the navigation entity position, so the user's head ends up
directly above where they were pointing.

Fixes #8408
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XrNavigation teleport lands short of target position

2 participants