summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2014-07-28 12:14:59 +0200
committerStanislaw Halik <sthalik@misaki.pl>2014-07-28 12:22:57 +0200
commitb3b44a7f8e6c1365a0c917517501866ac3c5f684 (patch)
tree7bbbeba7f85ca707e0d8f4ed57c6f7156bcc5f96 /ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
parent7bf7e2af2f6f62251eafc5ddd08db6effd3df751 (diff)
rift: position tracking, logic fixes
Diffstat (limited to 'ftnoir_tracker_rift/ftnoir_tracker_rift.cpp')
-rw-r--r--ftnoir_tracker_rift/ftnoir_tracker_rift.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
index 1c38e0fa..ba035467 100644
--- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
+++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
@@ -38,7 +38,8 @@ void Rift_Tracker::GetHeadPoseData(double *data)
{
frameTiming = ovrHmd_BeginFrameTiming(hmd, 0);
ovrSensorState ss = ovrHmd_GetSensorState(hmd, frameTiming.ScanoutMidpointSeconds);
- if(ss.StatusFlags & (ovrStatus_OrientationTracked | ovrStatus_PositionTracked)){
+ ovrHmd_EndFrameTiming(hmd);
+ if(ss.StatusFlags & ovrStatus_OrientationTracked) {
ovrPosef pose = ss.Predicted.Pose;
Quatf quat = pose.Orientation;
float yaw, pitch, roll;
@@ -52,16 +53,18 @@ void Rift_Tracker::GetHeadPoseData(double *data)
yaw += s.constant_drift;
old_yaw=yaw;
}
- if (s.bEnableYaw) {
+ if (s.bEnableYaw)
data[Yaw] = yaw * 57.295781f;
- }
- if (s.bEnablePitch) {
+ if (s.bEnablePitch)
data[Pitch] = pitch * 57.295781f;
- }
- if (s.bEnableRoll) {
+ if (s.bEnableRoll)
data[Roll] = roll * 57.295781f;
- }
- ovrHmd_EndFrameTiming(hmd);
+ if (s.bEnableX)
+ data[TX] = pose.Position.x * 1e-2;
+ if (s.bEnableY)
+ data[TY] = pose.Position.y * 1e-2;
+ if (s.bEnableX)
+ data[TZ] = pose.Position.z * 1e-2;
}
}
}