diff --git a/Engine/source/platform/input/openVR/openVRProvider.cpp b/Engine/source/platform/input/openVR/openVRProvider.cpp index 243cdb48a..fdf687afd 100644 --- a/Engine/source/platform/input/openVR/openVRProvider.cpp +++ b/Engine/source/platform/input/openVR/openVRProvider.cpp @@ -229,6 +229,7 @@ U32 OpenVRProvider::OVR_AXISTRIGGER[vr::k_unMaxTrackedDeviceCount] = { 0 }; EulerF OpenVRProvider::smHMDRotOffset(0); F32 OpenVRProvider::smHMDmvYaw = 0; F32 OpenVRProvider::smHMDmvPitch = 0; +bool OpenVRProvider::smRotateYawWithMoveActions = false; static String GetTrackedDeviceString(vr::IVRSystem *pHmd, vr::TrackedDeviceIndex_t unDevice, vr::TrackedDeviceProperty prop, vr::TrackedPropertyError *peError = NULL) { @@ -397,6 +398,8 @@ void OpenVRProvider::staticInit() Con::addVariable("$OpenVR::HMDmvYaw", TypeF32, &smHMDmvYaw); Con::addVariable("$OpenVR::HMDmvPitch", TypeF32, &smHMDmvPitch); + + Con::addVariable("$OpenVR::HMDRotateYawWithMoveActions", TypeBool, &smRotateYawWithMoveActions); } bool OpenVRProvider::enable() @@ -571,6 +574,11 @@ bool OpenVRProvider::process() if (!vr::VRCompositor()) return true; + if (smRotateYawWithMoveActions) + { + smHMDmvYaw += MoveManager::mRightAction - MoveManager::mLeftAction + MoveManager::mXAxis_L; + } + // Update HMD rotation offset smHMDRotOffset.z += smHMDmvYaw; smHMDRotOffset.x += smHMDmvPitch; @@ -969,7 +977,7 @@ void OpenVRProvider::updateTrackedPoses() // we will then be on a really weird rotation axis. QuatF(localRot).setMatrix(&rotOffset); rotOffset.inverse(); - mHMDRenderState.mHMDPose = rotOffset * mHMDRenderState.mHMDPose; + mHMDRenderState.mHMDPose = mat = rotOffset * mHMDRenderState.mHMDPose; // jamesu - store the last rotation for temp debugging MatrixF torqueMat(1); diff --git a/Engine/source/platform/input/openVR/openVRProvider.h b/Engine/source/platform/input/openVR/openVRProvider.h index 5b0e908a1..4080f1eac 100644 --- a/Engine/source/platform/input/openVR/openVRProvider.h +++ b/Engine/source/platform/input/openVR/openVRProvider.h @@ -283,6 +283,7 @@ public: static EulerF smHMDRotOffset; static F32 smHMDmvYaw; static F32 smHMDmvPitch; + static bool smRotateYawWithMoveActions; /// } public: