Skip to main content
New Participant
May 17, 2014

Getting head rotational data

For the life of me I can't find any documentation on using the OVRDevice class, am I barking up the wrong tree? I just want to get the angular velocity or orientation but using
OVRDevice.GetAngularVelocity()


is expecting arguments, the sensor and then a ref to x,y and z. Why am I needing to pass that function anything? it's a GET function right? is there another class to get the data from? If I have to pass that class some data to get it back, what's it expecting?

If you know a page that has examples please share as I have been unable to find it. Thanks!
    This topic has been closed for replies.

    2 replies

    Inspiring
    May 18, 2014
    "Get" functions sometimes want to return whether or not the Get succeeded, and since functions/methods can only return a single value, one simple solution is to return everything else via ref/out parameters.

    That way, you can do something like this:

    Quaternion q = Quaternion.identity;
    if(OVRDevice.GetOrientation(0, ref q))
    {
    Debug.Log("successfully retrieved orientation: " + q.eulerAngles.ToString());
    }
    else
    {
    Debug.Log("unable to retrieve orientation");
    }

    Also, based on the code I see in SDK 0.2.5c, just pass in 0 for the sensor parameter for now.

    Oh, and for the AngularVelocity one, I guess that's new for 0.3.1? Just a guess, but those x/y/z values it wants to return are probably angular velocities in degrees/second around those three axes.
    Titans of Space PLUS for Quest is now available on DrashVR.com
    New Participant
    May 18, 2014
    ah, ok that makes more sense now. Thanks for the example too, that's what I had been doing but it just didn't click as to why I needed to and then wondered if there was a better way I was missing.

    cheers