History

fix sixense and vive rotation readings for palms

Andrew Meadows committed 11 years ago

Commit 992bd5c1 parent 3e118525 files · +18 −14Browse files

Showing the changes to libraries/input-plugins/src/input-plugins/ViveControllerManager.cpp (1 of 5 files). Show all

Unified · Split

libraries/input-plugins/src/input-plugins/ViveControllerManager.cpp+6−7
@@ -362,18 +362,17 @@ void ViveControllerManager::handlePoseEvent(const mat4& mat, int index) { · 361 unmodified lines
362362 //
363363 // Qoffset = glm::inverse(deltaRotation when hand is posed fingers forward, palm down)
364364 //
365− // An approximate offset for the Vive can be obtained by inpection:
365+ // An approximate offset for the Vive can be obtained by inspection:
366366 //
367367 // Qoffset = glm::inverse(glm::angleAxis(sign * PI/4.0f, zAxis) * glm::angleAxis(PI/2.0f, xAxis))
368368 //
369−
370− // Finally there is another flip around the yAxis to re-align from model to Vive space, so the full equation is:
369+ // So the full equation is:
371370 //
372− // Q = yFlip * combinedMeasurement * viveToHand
371+ // Q = combinedMeasurement * viveToHand
373372 //
374− // Q = yFlip * (deltaQ * QOffset) * (yFlip * quarterTurnAboutX)
373+ // Q = (deltaQ * QOffset) * (yFlip * quarterTurnAboutX)
375374 //
376− // Q = yFlip * (deltaQ * inverse(deltaQForAlignedHand)) * (yFlip * quarterTurnAboutX)
375+ // Q = (deltaQ * inverse(deltaQForAlignedHand)) * (yFlip * quarterTurnAboutX)
377376
378377 const glm::quat quarterX = glm::angleAxis(PI / 2.0f, glm::vec3(1.0f, 0.0f, 0.0f));
379378 const glm::quat yFlip = glm::angleAxis(PI, glm::vec3(0.0f, 1.0f, 0.0f));
@@ -381,7 +380,7 @@ void ViveControllerManager::handlePoseEvent(const mat4& mat, int index) { · 1 unmodified line
381380 const glm::quat signedQuaterZ = glm::angleAxis(sign * PI / 2.0f, glm::vec3(0.0f, 0.0f, 1.0f));
382381 const glm::quat eighthX = glm::angleAxis(PI / 4.0f, glm::vec3(1.0f, 0.0f, 0.0f));
383382 const glm::quat offset = glm::inverse(signedQuaterZ * eighthX);
384− rotation = yFlip * rotation * offset * yFlip * quarterX;
383+ rotation = rotation * offset * yFlip * quarterX;
385384
386385 position += rotation * glm::vec3(0, 0, -CONTROLLER_LENGTH_OFFSET);
387386