Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
BlackFang's avatar
BlackFang
Honored Guest
12 years ago

Position Data: What units is this?

What units does GetCurrentPose(CurrentOrientation, CurrentPosition); return the position in? I'm really struggling integrating position tracking. I've been guessing around with how to scale it but I can't really get anywhere without knowing what it is supposed to be. If I have already guessed correctly, then I have a problem somewhere else. So? cm? mm? m?

4 Replies

Replies have been turned off for this discussion
  • DiCon's avatar
    DiCon
    Honored Guest
    Everything in the SDK is in meters: IPD, frustum distance, the "view adjust" vector, acceleration (in m/s²) and also the position. This works perfectly for me and it is the most intuitive choice of units, so I never thought about it as it also matches the way my engine works. But now, that I tried to find this info in the doc, I only found the sentence "All of the units are measured in meters." (p. 14, SDK 0.4.1), which is in a context that makes it sound like it refers to the World Demo...
  • Thank you very much. Do you know anything about the axis arrangement? Is it Z up, X forward, Y right? Maybe this is my problem.
  • DiCon's avatar
    DiCon
    Honored Guest
    EDIT: I just noticed, that we are discussing UE4 integration - I did not notice this as I came here through the "new posts" link. So, please keep in mind that I was talking about generic engine SDK integration - Things might be slightly different for UE4 as I have never used it myself. Sorry.

    Nope, it is in "typical" view coordinates with z beeing perpendicular to the screen (although I also did some try and error myself as I got confused with left- and right-handed coordinates). There is a sketch on page 21.

    Also make sure, to do all your transformations in the correct order. You should do your own model transform, then your own view transform (orientation of the player), then the Rift position (relative to your view), then the Rift orientation, then the eye adjust vector for the IPD and finally the projection. Also, depending on your math lib and your coordinate system (also DX/OpenGL?), you might need to transpose the SDK matrices...

    So in my engine the actual MVP used in my vertex shaders for a single eye is constructed as follows:

    Projection x viewAdjust x hmdOrientation x hmdPosition x gameView x Model x [vertexCoord]

    with Projection being the transposed matrix from ovrMatrix4f_Projection(...), viewAdjust being a translation matrix constructed from the IPD vector, hmdOrientation a matrix constructed from the orientation quaternion, hmdPosition a translation matrix from the hmd position and finally, gameView and model being my own matrices describing position and orientation of the player and object.

    (I hope, I did not confuse the order - please confirm, if it worked)
  • Well, axis order is correct. For whatever reason, scaling the position data up by a factor of ten feels right. Thanks for the help.