diff options
author | mm0zct <the_cartographer@hotmail.com> | 2013-10-05 11:14:46 +0100 |
---|---|---|
committer | mm0zct <the_cartographer@hotmail.com> | 2013-10-05 11:14:46 +0100 |
commit | e5f1e165616bd1dfcfbdf8fd19228fee2a657bc9 (patch) | |
tree | 1f792b8b9b2480a0ef0b4444c75a7b3b57b0cfdc /ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | |
parent | ee843add4063931d8a0331eba3d60c8a579d0661 (diff) |
added a re-centre spring effect, optional compiler preprocessor, enabled by default
Diffstat (limited to 'ftnoir_tracker_rift/ftnoir_tracker_rift.cpp')
-rw-r--r-- | ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index 0c3984ac..e58dbf1b 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -6,6 +6,9 @@ using namespace OVR; +//used to turn on the re-centre spring effect +#define RECENTRE_SPRING + Rift_Tracker::Rift_Tracker() { pSensor.Clear(); @@ -14,6 +17,7 @@ Rift_Tracker::Rift_Tracker() bEnableRoll = true; bEnablePitch = true; bEnableYaw = true; + old_yaw = 0.0; #if 0 bEnableX = true; bEnableY = true; @@ -100,7 +104,14 @@ bool Rift_Tracker::GiveHeadPoseData(double *data) float pitch = 0.0f; float roll = 0.0f; hmdOrient.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(&yaw, &pitch , &roll); - newHeadPose[Yaw] = yaw; +#ifdef RECENTRE_SPRING + newHeadPose[Yaw] = newHeadPose[Yaw]*0.99999 + (yaw-old_yaw); + if(newHeadPose[Yaw]>0.02)newHeadPose[Yaw]-= 0.000005; + if(newHeadPose[Yaw]<-0.02)newHeadPose[Yaw]+= 0.000005; + old_yaw=yaw; +#else + newHeadPose[Yaw] = yaw; +#endif newHeadPose[Pitch] =pitch; newHeadPose[Roll] = roll; |