Skip to content

Commit

Permalink
OpenVRHMD.kt: Fix getPosition
Browse files Browse the repository at this point in the history
  • Loading branch information
moreApi committed Aug 16, 2021
1 parent 78be8b6 commit 999a4b3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/kotlin/graphics/scenery/controls/OpenVRHMD.kt
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,9 @@ open class OpenVRHMD(val seated: Boolean = false, val useCompositor: Boolean = t
*/
override fun getPosition(): Vector3f {
val m = getPose()
return Vector3f(-1.0f * m.get(0, 3), -1.0f * m.get(1, 3), -1.0f * m.get(2, 3))
val d = Vector3f(-1.0f * m.get(3, 0), -1.0f * m.get(3, 1), -1.0f * m.get(3, 2))
// the position is already rotated by the orientation therefore we need to inverse that the get the absolute position
return d.rotate(getOrientation().conjugate())
}

/**
Expand Down

0 comments on commit 999a4b3

Please sign in to comment.