Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
oculus_dzne's avatar
oculus_dzne
Explorer
9 years ago

OVRDisplay.ResetPose only works for yaw?

Hello everyone, 

for a research paradigm, we are giving our participants a DK2 HMD. We want them to be immersed in the experiment, hence the HMD. Because we have the Camera OBJ drive a preconfigured path, we do not want them to be able to look around. After lots of try and error, we figured that calling OVRDevice.ResetDisplay in Update() helps, but only "disables" the movement for one axis, but we need it for all three.

Is that the intended behaviour or is it possible that the path-generator iTween interferes?

Could it help calling ResetPose on OVRPlayercontroller?

Any help greatly appreciated.

Thanks
/seb

7 Replies

  • Yes, this is the intended behavior. The point of that function call is to reset the forward looking direction (in yaw only) as the user may have turned their seat or be facing in a different direction. Pitch and roll should always be taken directly from the headset orientation, as setting it otherwise causes discomfort.

    I would actually recommend you DO NOT disable head-tracking as this will cause discomfort for users. However, if you must, you can place the camera as a child of an empty GameObject, and on the parent Update set it's position/orientation to the inverse of the camera.

    The code looks like this:

    using UnityEngine;
    using System.Collections;

    public class DisableTracking : MonoBehaviour {
    private Camera cam;
    private Vector3 startPos;

    void Start () {
    cam = GetComponentInChildren<Camera>();
    startPos = transform.localPosition;
    }

    void Update () {
    transform.localPosition = startPos - cam.transform.localPosition;
    transform.localRotation = Quaternion.Inverse(cam.transform.localRotation);
    }
    }


  • Thank you so much cyberreality, it was the local rotation that we were missing. You saved my weekend!
  • Is it possible to do this for two axes only as well? 

    I tried: 

    Quaternion inverse = Quaternion.Inverse(cam.transform.localRotation);
    Quaternion newRotation = new Quaternion(inverse.x, InputTracking.VRNode.Head.localRotation.eulerAngles.y, inverse.x, inverse.w);
    transform.localRotation = newRotation.

    However, this induces drift and, top of all, does not work anyway.


    We would like to constrain movement of the Oculus to the horizontal axis. 

    Help is, as always, greatly appreciated.

    Thanks!
  • Yes, you can to that, though I don't recommend it. It will make people very uncomfortable. Your issue is that you can't replace Quaternion elements with Euler angles. They are completely different concepts.
  • Cybereality, 

    the blocking of the HMD axis in only two of three axis does not seem to work in a build, only in the editor. Is there a way I can check build logs or anything that would allow me to see what's going on?

    With best regards
    Seb