Recenter camera for 6DOF tracking


I am trying to re-center my scene by pressing a button but so far I fail to achieve it.

Actually Recenter() in NRSessionManager is doing exactly what I want but it only works on 3DOF tracking. Is there a way to re-center my AR scene in 6DOF tracking, i.e. set the 6DOF pose of the camera back to the origin and the initial orientation of the scene?

Thanks for your help!

1 Like

A Reset 6dofpose interface is added in NRSDK 1.6.0:
var hmdPoseTracker = NRSessionManager.Instance.NRHMDPoseTracker;
However, use of this function may affect plane detection and image detection, so please use it with caution.

Thank you for your help. I just updated my Unity project to NRSDK 1.6.0 but there is no ResetWorldMatrix() in my NRHMDPoseTracker. I get the following error:

NRHMDPoseTracker’ does not contain a definition for ‘ResetWorldMatrix’ and no accessible extension method ‘ResetWorldMatrix’ accepting a first argument of type ‘NRHMDPoseTracker’ could be found (are you missing a using directive or an assembly reference?)

I only have what is documented here (at least more or less):

I am using Unity 2019.4.20f1 if that makes a difference.

An implementation of this function can be added to the HMDPoseTracker:

    /// Reset world matrix ,position:(0,0,0) ,rotation:(x,0,z) 
    public void ResetWorldMatrix()
        Pose pose;
        if (UseRelative)
            pose = new Pose(transform.localPosition, transform.localRotation);
            pose = new Pose(transform.position, transform.rotation);

        Plane horizontal_plane = new Plane(Vector3.up,;
        Vector3 forward_use_gravity = horizontal_plane.ClosestPointOnPlane(pose.forward).normalized;
        Quaternion rotation_use_gravity = Quaternion.LookRotation(forward_use_gravity, Vector3.up);
        var matrix = ConversionUtility.GetTMatrix(pose.position, rotation_use_gravity);
        cachedWorldMatrix = Matrix4x4.Inverse(matrix) * cachedWorldMatrix;

Thanks, this is great! It does exactly what I wanted.