From ade4234b1ae0a18e91bfca1d305e38ffc40c7b54 Mon Sep 17 00:00:00 2001 From: zelmon64 Date: Wed, 8 Mar 2017 09:16:08 +0000 Subject: [PATCH] Fixed rotation away from the origin Rotation when away from the origin is now applied to the current position rather than rotating about the origin. --- src/overlaycontroller.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlaycontroller.cpp b/src/overlaycontroller.cpp index 6f9def5f..883c8e0c 100644 --- a/src/overlaycontroller.cpp +++ b/src/overlaycontroller.cpp @@ -445,9 +445,9 @@ void OverlayController::RotateUniverseCenter(vr::ETrackingUniverseOrigin univers vr::HmdMatrix34_t newPos; utils::initRotationMatrix(rotMat, 1, yAngle); utils::matMul33(newPos, rotMat, curPos); - newPos.m[0][3] = curPos.m[0][3]; + newPos.m[0][3] = std::cos(yAngle) * curPos.m[0][3] + std::sin(yAngle) * curPos.m[2][3]; newPos.m[1][3] = curPos.m[1][3]; - newPos.m[2][3] = curPos.m[2][3]; + newPos.m[2][3] = std::cos(yAngle) * curPos.m[2][3] - std::sin(yAngle) * curPos.m[0][3]; if (universe == vr::TrackingUniverseStanding) { vr::VRChaperoneSetup()->SetWorkingStandingZeroPoseToRawTrackingPose(&newPos); } else {