There is an issue with offset of the child object relative to the camera on mobile device. I have created a simple scene as an example to show the problem with the following hierarchy.
Red crosshair at the center of the local canvas attached to the camera, and white point at the center of the screen overlay canvas. So there how these markers look like in the simulator - both in the center of the screen, logically.
The white point is exactly in the center of the screen, but AR Camera’s child has a small offset (I used local canvas for better representation, but problem also remains for 3d objects). There are different offsets for different device screens.
Have no idea what can cause this displacement. It doesn’t look like a position offset, but like cropped rendering of AR Camera’s child objects. Hope there should be an acceptable solution
I was able to reproduce the same behavior. I determined it’s caused by the ARCameraFrameEventArgs.projectionMatrix.
AR Foundation modifies ARCamera’s projection matrix to match the projectionMatrix coming from a native AR provider.
Weirdly enough, the displacement is only happening with enabled Plane Tracking (tested only on iOS).
Moreover, the projectionMatrix is always changing on iOS. At first, I thought it may be connected to Auto Focus, but even with disabled Auto Focus, the projectionMatrix is changing slightly when you move the device around.
I have discovered some new stuff about how ARCamera works. But I couldn’t find a way to control projection matrix directly (and I don’t think its necessary).
To solve my issue I’ve just added a local camera down the ARCamera hierarchy, which renders only local objects (AR camera renders everything else, respectively). So I got the result I needed, but not sure its the best one.