Skip to main content
Up and Coming
February 19, 2015

Setting IPD in code ?

Hi there,

Found nothing about this on the forum, so excuse me if this question has already been answered.

For my custom needs, I cannot rely on the users management provided by the OVR config tool, and I have to override this behavior, so that I can set the IPD from somewhere else (by code, either directly from my Unity application, or from another application).

Is there any proper way to do this ? (by setting up a registry key, or modifying a config file before running my VR application ?)

Thanks,
Roland Tomczak

    4 replies

    Inspiring
    February 19, 2015
    You should be able to update the user profile's IPD in the current process by calling
    OVRManager.capiHmd.SetFloat(Ovr.Hmd.OVR_KEY_IPD, newIpd);
    rolsctAuthor
    Up and Coming
    February 20, 2015
    So easy.. thank you :-)
    rolsctAuthor
    Up and Coming
    February 26, 2015
    Hum.. I must have missed something !
    But the somewhat simple sequence

    float newIpd = 0.068f;
    OVRManager.capiHmd.SetFloat(Ovr.Hmd.OVR_KEY_IPD, newIpd);
    var refFloat = OVRManager.capiHmd.GetFloat(Ovr.Hmd.OVR_KEY_IPD, DEFAULT_IPD);

    doesn't returns my custom IPD, but the one being registered in the Oculus config profil.

    So, I cannot be really sure that the custom IPD is taken in account. Am I missing something ? I tried to set up this snippet at different places (before the OVR prefab is instantiated, before the Menu component is instantiated, OnUpdate, etc..), it doesn't seem to have any impact.

    Thank you !

    Rolsct
    Inspiring
    February 27, 2015
    Sorry, it turns out OVR_KEY_IPD is read-only. So you will have to restart the app with a different user profile to change it. So OVRCameraRig doesn't support custom IPDs. You can write your own camera behavior and add a handler to the OVRCameraRig.UpdatedAnchors event to override ours.