summaryrefslogtreecommitdiffhomepage
path: root/opentrack
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-02-01 03:15:38 +0100
committerStanislaw Halik <sthalik@misaki.pl>2015-02-01 03:15:38 +0100
commit241a8eb4f2461b2fb1635a702a10013510d09f0a (patch)
tree9018c5292037cbc380ef4064f05a55fc61fb3a72 /opentrack
parent9147e33c548fba3cf9baf267fc46517cabbbb487 (diff)
center when first pose received
Requested-by: many
Diffstat (limited to 'opentrack')
-rw-r--r--opentrack/tracker.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/opentrack/tracker.cpp b/opentrack/tracker.cpp
index a6f228e7..338c9113 100644
--- a/opentrack/tracker.cpp
+++ b/opentrack/tracker.cpp
@@ -24,7 +24,7 @@
Tracker::Tracker(main_settings& s, Mappings &m, SelectedLibraries &libs) :
s(s),
m(m),
- centerp(false),
+ centerp(true),
enabledp(true),
zero_(false),
should_quit(false),
@@ -106,8 +106,20 @@ void Tracker::logic()
r = cam * r;
+ bool can_center = false;
+
if (centerp)
{
+ for (int i = 0; i < 6; i++)
+ if (fabs(newpose[i]) != 0)
+ {
+ can_center = true;
+ break;
+ }
+ }
+
+ if (can_center)
+ {
centerp = false;
for (int i = 0; i < 3; i++)
t_b[i] = t(i, 0);
@@ -179,7 +191,7 @@ void Tracker::run() {
{
t.start();
- double tmp[6];
+ double tmp[6] {0,0,0, 0,0,0};
libs.pTracker->data(tmp);
if (enabledp)