How to set the initial ML2 headposition as the spawning 0 point. The trouble I'm running into is that the 3D objects are at a static point, but I would like them to spawn in front of the ML user.
When I start the session, in my case for a split second the 3D cube spawns right in front of me, but then the camera origin spawning point (or headpose) makes it appear to the left or right of me. Whilst I have everything at 0 position.
Please see the enclosed screenshots, any help would be appreciated!
Headpose is an ongoing calculation of the headset position from the point that it was first booted. The "spawn" point that you're referring to in Unity is actually a reflection of all of the movement since the device was turned on.
As a concept in AR, this is why it is important to ignore the literal headpose Camera position when placing virtual content. Content should be placed relative to something else (with a known position; see note on documentation below for more info). Content should never be placed in a specific position in your scene (such as an exact coordinate), because you don't necessarily control your users' environments. This is a difference in VR development versus AR with 6 Degrees of Freedom.
I recommend reading up on our Spatial Anchors documentation to be able to accomplish relative content placement using best practices.
However, if you absolutely must reset your headpose to (0, 0, 0), try the following, in-Scene:
THIS IS NOT A BEST-PRACTICE WORKFLOW
private IEnumerator Start()
{
// Wait for a frame so the XR system can initialize before moving the origin
yield return new WaitForEndOfFrame();
var xro = FindObjectOfType<Unity.XR.CoreUtils.XROrigin>();
xro?.MoveCameraToWorldLocation(Vector3.zero);
xro?.MatchOriginUpCameraForward(Vector3.up, Vector3.forward);
}
A future update allow for this start-at-zero workflow natively, but this is not-yet enabled/possible.