0

I'm working on 3D digitizing using a Vive controller. I'm using OpenVR to talk to the hardware and PollNextEventWithPose to get the controller's pose at the time the user pressed a button. From the pose, I want to calculate a point that's 177mm along the Z axis where our digitizing point is.

Running under Unity, I did something like this:

var digitizerPosition = trackedObject.transform.position - trackedObject.transform.forward * 0.177f;

Now under OpenVR, PollNextEventWithPose gives me a TrackedDevicePose_t which contains the field mDeviceToAbsoluteTracking which is of type Valve.VR.HmdMatrix34_t. Given that matrix, how do I calculate a point along the Z axis?

SSteve
  • 10,550
  • 5
  • 46
  • 72

1 Answers1

0

The equivalent of trackedObject.transform.forward is:

    public static Vector3D Forward(HmdMatrix34_t matrix)
    {
        return new Vector3D(matrix.m2, matrix.m6, matrix.m10);
    }
SSteve
  • 10,550
  • 5
  • 46
  • 72