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
326326 void OculusControllerManager::TouchDevice::handleHeadPose(float deltaTime,
327327 const controller::InputCalibrationData& inputCalibrationData,
328328 const ovrPoseStatef& headPose) {
329− auto poseId = controller::HEAD;
330− auto& pose = _poseStateMap[poseId];
329+ glm::mat4 mat = createMatFromQuatAndPos(toGlm(headPose.ThePose.Orientation),
330+ toGlm(headPose.ThePose.Position));
331331
332− static const glm::quat yFlip = glm::angleAxis(PI, Vectors::UNIT_Y);
333− pose.translation = toGlm(headPose.ThePose.Position);
334− pose.rotation = toGlm(headPose.ThePose.Orientation) * yFlip;
335− pose.angularVelocity = toGlm(headPose.AngularVelocity);
336− pose.velocity = toGlm(headPose.LinearVelocity);
337− pose.valid = true;
332+ //perform a 180 flip to make the HMD face the +z instead of -z, beacuse the head faces +z
333+ glm::mat4 matYFlip = mat * Matrices::Y_180;
334+ controller::Pose pose(extractTranslation(matYFlip),
335+ glmExtractRotation(matYFlip),
336+ toGlm(headPose.LinearVelocity), // XXX * matYFlip ?
337+ toGlm(headPose.AngularVelocity));
338338
339− // transform into avatar frame
340− glm::mat4 controllerToAvatar = glm::inverse(inputCalibrationData.avatarMat) * inputCalibrationData.sensorToWorldMat;
341− pose = pose.transform(controllerToAvatar);
339+ glm::mat4 sensorToAvatar = glm::inverse(inputCalibrationData.avatarMat) * inputCalibrationData.sensorToWorldMat;
340+ glm::mat4 defaultHeadOffset = glm::inverse(inputCalibrationData.defaultCenterEyeMat) *
341+ inputCalibrationData.defaultHeadMat;
342+
343+ controller::Pose hmdHeadPose = pose.transform(sensorToAvatar);
344+
345+ pose.valid = true;
346+ _poseStateMap[controller::HEAD] = hmdHeadPose.postTransform(defaultHeadOffset);
342347 }
343348
344349 void 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