Completely disable position tracking

Hi everyone

I am doing a psychological research that requires me to present the visual stimulus on both Oculus Rift and HTC Vive. I am using Unity to build to experiment program, but to avoid any confounding, I have to disable position tracking.
What I mean is that I am trying to treat the headset as a simple 3D display (pretend that I stick two images in front of it) that no head movement will be tracked (the position and rotation of the camera will always be 0,0,0).
Could someone point me to which script I should modify to achieve this goal?

Thanks a lot.

1 Like

You can negate the default tracking pretty easily. First create a new game object and make it a parent of your camera. Be sure to zero out both transforms. Then attach this script to the parent game object:

using UnityEngine;
using UnityEngine.VR;

public class NegateTracking : MonoBehaviour
{
    void Update()
    {
        transform.position = -InputTracking.GetLocalPosition(VRNode.CenterEye);
        transform.rotation = Quaternion.Inverse(InputTracking.GetLocalRotation(VRNode.CenterEye));
    }
}

That will give the parent the inverse transform of the camera effectively negating tracking, thus keeping the view in the HMD stable at the origin.

5 Likes

It works, thanks a lot for the help.
I am now facing another issue. Since I am going to generate the stimulus at a specific location (i.e. (0, 0, 50f)) when a key is pressed, but it seems that it the stimulus will be created based on (0,0,0) in the scene, which it appears off the center (and I can see that it tilts when I move my head).
Is there a way for me to keep the stimulus at the center of the screen? (maybe constantly update the position of the stimulus?)

Thanks a lot for the help

Hi Nick,

The solution above does away with the positional tracking but also with the neck modeling. (offset from your neck to your eyes) there is no parallax anymore when rotating your head. Would be good if we could access something in VRSettings to turn off tracking but still get some head modeling on the camera.

thoughts on an intermediate solution?

T

1 Like
UnityEngine.VR.InputTracking.disablePositionalTracking = true;
7 Likes

Hi Nick, I happen do be working on something very similar to Cozywolf’s project, and I was trying to get the soultion you gave to work, with no success. What exactly do you mean by “Be sure to zero out both transforms”? Any help would be appreciated.

in 2017.2 you can now use the Tracked Pose Driver to apply only the rotation of a given pose. (or none at all by disabling the component).

in revisions before 2017.2, using UnityEngine.VR.InputTracking.disablePositionalTracking = true; will stop position deltas being applied to the current “main” camera.

Ok, I upgraded to 2017.2 and tried disabling the Tracked Pose Driver, but whenever I build and run the project it still keeps tracking the head position, is there any more specific info such as what object the script should be attached to or how to get the correct Tracked Pose Driver?

Thanks!

The Tracked Pose Driver (TPD) should be attached to the camera you are trying to stop the VR subsystem controlling

When doing that, and disabling the TPD - The camera still seems to move (up and down) with a slight jitter. Do you have any idea why?

Nope, please raise a bug on that. It’s not something we’ve seen.

Hi. I am trying to disable the head rotation tracking. I came across this thread and tried adding the Tracked Pose Driver component to my camera and disabling it, but that does not prevent HMD pose from setting the camera rotation. Is that possible in any way? I also tried doing transform.rotation = Quaternion.identity; in LateUpdate() and in PreRender(), but still the HMD pose overrides whatever I try to set as the rotation. Is this because under the hood Unity sets the rotation based on the HMD pose after PreRender is executed? Is there any way to prevent this?

Im thinking maybe the rotation setting is prevented so that devs would never be able to take control over the camera rotation and therefore create a VR vomit generator 3000? =)

I know it is unusual to force the camera rotation in a VR app, but it is necessary in my case - I am developing sort of a test application where in one mode I would need to ignore the real HMD pose and artificially set the camera rotation (and position)).

The tracked pose driver should disable the auto update on the camera. There’s a VR Device call, which takes the camera as a parameter. it only works if the TPD is on the camera object though.

Even when the TPD is disabled, the automatic camera control is still disabled. Does this rotation apply still happen with a new empty project?

Hey all,

I need to disable VR position tracking, but keep rotation tracking, I’m using Unity 2018.2.11f1, will any of these solutions work for this version of Unity? Would you mind explaining how to do it?

Thank you!!
Claudia

1 Like

using UnityEngine;
using UnityEngine.XR;

public class Trackingoff : MonoBehaviour
{
void Update()
{
transform.position = -InputTracking.GetLocalPosition(XRNode.CenterEye);
//transform.rotation = Quaternion.Inverse(InputTracking.GetLocalRotation(XRNode.CenterEye));
}
}

Hi, just a little update on the code to work with Unity 2018 . I,m making 360 still images with 3d object added. Its handy to use the vive to test things on the go.

Thank you, I have tried this, but unfortunately it doesn’t work - my camera still jumps up into the air by several feet

Now it is UnityEngine.XR.InputTracking.disablePositionalTracking = true;

I’m attempting the same thing as the people above. I’ve used:

 UnityEngine.XR.InputTracking.disablePositionalTracking = true;

and also attached a Tracked Pose Driver to all three cameras in the OVRCameraRig (LeftEyeAnchor, CenterEyeAnchor, RightEyeAnchor). So far, nothing disables the position tracking. I’m trying to get this working on an HTC Vive with 2018.2.10f1. Any suggestions?

Hi, I have disabled for oculus quest.On OVRCameraRig prefab the OVRManager component has attached. OVRManager has provided UsePositionTracking properties. so you have to uncheck that.
simple:).