History

work on fixing some head to eye offsets. MyHead::getHmdOrientation to MyHead::getHeadOrientation

Seth Alves committed 9 years ago

Commit 3359a0a1 parent c40a76f5 files · +57 −47Browse files

Showing the changes to plugins/oculus/src/OculusControllerManager.cpp (1 of 5 files). Show all

Unified · Split

plugins/oculus/src/OculusControllerManager.cpp+16−11
@@ -326,19 +326,24 @@ void OculusControllerManager::TouchDevice::handlePose(float deltaTime, · 325 unmodified lines
326void OculusControllerManager::TouchDevice::handleHeadPose(float deltaTime,326void OculusControllerManager::TouchDevice::handleHeadPose(float deltaTime,
327 const controller::InputCalibrationData& inputCalibrationData,327 const controller::InputCalibrationData& inputCalibrationData,
328 const ovrPoseStatef& headPose) {328 const ovrPoseStatef& headPose) {
329 auto poseId = controller::HEAD;329 glm::mat4 mat = createMatFromQuatAndPos(toGlm(headPose.ThePose.Orientation),
330 auto& pose = _poseStateMap[poseId];330 toGlm(headPose.ThePose.Position));
331 331
332 static const glm::quat yFlip = glm::angleAxis(PI, Vectors::UNIT_Y);332 //perform a 180 flip to make the HMD face the +z instead of -z, beacuse the head faces +z
333 pose.translation = toGlm(headPose.ThePose.Position);333 glm::mat4 matYFlip = mat * Matrices::Y_180;
334 pose.rotation = toGlm(headPose.ThePose.Orientation) * yFlip;334 controller::Pose pose(extractTranslation(matYFlip),
335 pose.angularVelocity = toGlm(headPose.AngularVelocity);335 glmExtractRotation(matYFlip),
336 pose.velocity = toGlm(headPose.LinearVelocity);336 toGlm(headPose.LinearVelocity), // XXX * matYFlip ?
337 pose.valid = true;337 toGlm(headPose.AngularVelocity));
338 338
339 // transform into avatar frame339 glm::mat4 sensorToAvatar = glm::inverse(inputCalibrationData.avatarMat) * inputCalibrationData.sensorToWorldMat;
340 glm::mat4 controllerToAvatar = glm::inverse(inputCalibrationData.avatarMat) * inputCalibrationData.sensorToWorldMat;340 glm::mat4 defaultHeadOffset = glm::inverse(inputCalibrationData.defaultCenterEyeMat) *
341 pose = pose.transform(controllerToAvatar);341 inputCalibrationData.defaultHeadMat;
342
343 controller::Pose hmdHeadPose = pose.transform(sensorToAvatar);
344
345 pose.valid = true;
346 _poseStateMap[controller::HEAD] = hmdHeadPose.postTransform(defaultHeadOffset);
342}347}
343 348
344void OculusControllerManager::TouchDevice::handleRotationForUntrackedHand(const controller::InputCalibrationData& inputCalibrationData,349void OculusControllerManager::TouchDevice::handleRotationForUntrackedHand(const controller::InputCalibrationData& inputCalibrationData,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t