Camera position offset

We found that there is always a positional offset between Camera.main.transform.position and the actual rendering position on both simulator and headset.

1 Like

yes we have seen this issue aswell

Hi there! Sorry to hear you are having trouble.

My first question is whether this is a fully immersive VR build (Metal rendering, no passthrough video) or MR build (PolySpatial/RealityKit rendering, with passthrough video).

For MR, I wouldn’t expect the rendering position to match the main camera unless you are using a VolumeCamera in the Unbounded configuration (or allowing the system to create the default for you) and an AR Session with a Tracked Pose Driver on the Main Camera.

If you are making VR builds, and the rendered image isn’t “head locked,” meaning it changes as you move your head around, that means some camera is being transformed by the head pose input. Is it possible you have more than one camera in your scene? By default, the Create > XR > XR Origin menu action will add a new camera to your scene which is not tagged as Main Camera. Unless you’ve deleted the existing default scene camera and tagged the new one as Main Camera, you would see Camera.main return a camera whose transform does not match the head pose.

If you only have one camera, or if you are sure your Camera.main is being tracked, then this may be a bug we have to fix on our side. In that case, could you please provide a project or scene that reproduces the issue?

Thanks, and good luck!

Hi,

Here is the setup of our project:

  • Unity 2022.3.12f1
  • PolySpatial 0.6.3
  • App Mode - Mixed Reality - Volume or Immersive Space
  • Only one camera with a tag “MainCamera”
  • Volume camera in unbounded configuration
  • Has an ARSession object
  • Has a TrackedPoseDriver on the main camera

This is what we see, as I added a few cubes to the main camera to show its position and rotation. The rotation is matched, but there is a positional offset in world space.|

We realize this issue because we try to cast a ray from the main camera, and found that the position is wrong.

We corrected our setup, now the camera position is correct. Thanks.

Hi, sorry we think we know the cause of our camera offset issue.

Our game need to relocate the player in the scene by relocating the camera rig. However, changing the position of the camera rig doesn’t change the rendering position on headset.

Here is our sample project to reproduce the issue, thanks.

Do you have any suggestions if we need to relocate the player in game?

For mixed reality builds, you need to move the Volume Camera object in addition to the XR Origin.

1 Like

can the volume camera just be a child of xr origin?

Yes, I just tried to do this a few minutes ago. It works.

3 Likes

how do this? volume camera is child of the XROrigin?