From 2cb701bce6cc751978df97069ebdc17a96c27e9d Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Mon, 25 Nov 2013 17:28:33 -0800 Subject: [PATCH] Added adjustment for hydra position to user (it matters) --- interface/src/devices/SixenseManager.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/interface/src/devices/SixenseManager.cpp b/interface/src/devices/SixenseManager.cpp index fcb795eaed..dfeab1f309 100644 --- a/interface/src/devices/SixenseManager.cpp +++ b/interface/src/devices/SixenseManager.cpp @@ -58,12 +58,20 @@ void SixenseManager::update() { avatar->setDriveKeys(DOWN, data.trigger); } - // set palm position and normal based on Hydra position/orientation + // Set palm position and normal based on Hydra position/orientation PalmData palm(&hand); palm.setActive(true); - glm::vec3 position(-data.pos[0], data.pos[1], -data.pos[2]); + glm::vec3 position(data.pos[0], data.pos[1], data.pos[2]); + + // Adjust for distance between acquisition 'orb' and the user's torso + // (distance to the right of body center, distance below torso, distance behind torso) + const glm::vec3 SPHERE_TO_TORSO(-250.f, -300.f, -300.f); + position = SPHERE_TO_TORSO + position; palm.setRawPosition(position); glm::quat rotation(data.rot_quat[3], -data.rot_quat[0], data.rot_quat[1], -data.rot_quat[2]); + + // Rotate about controller + rotation = glm::angleAxis(180.0f, 0.f, 1.f, 0.f) * rotation; const glm::vec3 PALM_VECTOR(0.0f, -1.0f, 0.0f); palm.setRawNormal(rotation * PALM_VECTOR);