2

I'm trying to find the direction in which my oculus touch controller is pointing at any given point in time in OpenVR. (The direction in which you would render a ray pointer from the controller) I am using the following function

GetControllerStateWithPose( TrackingUniverseStanding, deviceId, &controllerState, sizeof(controllerState), &trackedDevicePose);

In the picture below, I understand that the position is described by m12 m13 and M14 for x, y and z. But how do I use the m0 to m10 values to find a direction vector in which the controller points at any given time.

Can't post images because of my new account but it can be found here https://camo.githubusercontent.com/d83363a745afeeb1ac7265d10ad55544e15a8fe9/687474703a2f2f7777772e736f6e67686f2e63612f6f70656e676c2f66696c65732f676c5f616e676c6573746f6178657330312e706e67

Would I simply multiply this matrix by [1,1,1,0]^T? Or maybe [0,0,1,0]^T since Z axis is the describes as the forward direction

Thanks

A Singh
  • 21
  • 1

1 Answers1

0

I had this problem too (OpenVR Teleportation Problem (Forward direction calculation)). I know that this is a very old question but I figured for the sake of completeness to give the answer here as well.

The methodology here is correct but OpenVR defines its controller's forward vector as vec4(0,0,-1,0). You should be able to multiply the pose matrix by this vector to get the direction. Keep in mind that this is relative to the HMD and do transformations accordingly.