summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
diff options
context:
space:
mode:
authormm0zct <the_cartographer@hotmail.com>2013-11-26 04:08:23 +0000
committermm0zct <the_cartographer@hotmail.com>2013-11-26 04:08:23 +0000
commit3895beb6bbc6aaaaf167f1db99b7078506a83622 (patch)
tree3e8490c55eb7937611ef31fd364cec0e64471016 /ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
parent78b570ca271f7e494615538f2c4fac618e79b015 (diff)
Added positional tracking?!
perhaps, perhaps not.. to be tested -mm0zct
Diffstat (limited to 'ftnoir_tracker_rift/ftnoir_tracker_rift.cpp')
-rw-r--r--ftnoir_tracker_rift/ftnoir_tracker_rift.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
index dd78bf9f..45c02cfb 100644
--- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
+++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
@@ -88,11 +88,23 @@ bool Rift_Tracker::GiveHeadPoseData(double *data)
if(newHeadPose[Yaw]<-deadzone)newHeadPose[Yaw]+= constant_drift;
old_yaw=yaw;
}
-#if 0
- newHeadPose[TX] = acd.controllers[0].pos[0]/50.0f;
- newHeadPose[TY] = acd.controllers[0].pos[1]/50.0f;
- newHeadPose[TZ] = acd.controllers[0].pos[2]/50.0f;
-
+#if 1
+
+ double dt = 0.015;
+
+ OVR::Vector3f acc = pSFusion->GetAcceleration();
+ old_x = old_x*persistence + vx*dt + 0.5*(acc.x*acc.x);
+ vx = vx*persistence + acc.x*dt;
+ newHeadPose[TX] = old_x;
+
+ old_y = old_y*persistence + vy*dt + 0.5*(acc.y*acc.y);
+ vy = vy*persistence + acc.y*dt;
+ newHeadPose[TY] = old_y;
+
+ old_z = old_z*persistence + vz*dt + 0.5*(acc.z*acc.z);
+ vz = vz*persistence + acc.z*dt;
+ newHeadPose[TZ] = old_z;
+
if (bEnableX) {
data[TX] = newHeadPose[TX];
}