aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWebFreak001 <gh@webfreak.org>2020-06-11 23:14:41 +0200
committerdec05eba <dec05eba@protonmail.com>2020-06-13 07:21:25 +0200
commit31a071d0fac616dd2b68e6c2e8afb8d3a891afbc (patch)
treeaf1ca853d0b5fe5abe9bc327e5607aa009ce5802
parent39ad015f64e98a5b11568917f57ea72f4362f4ef (diff)
make moving around head not move around picture
use reset rotation (W) to reset position as well now
-rw-r--r--src/main.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp
index bd6ca59..46e06ff 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -214,6 +214,7 @@ private: // OpenGL bookkeeping
glm::mat4 m_mat4ProjectionLeft;
glm::mat4 m_mat4ProjectionRight;
+ glm::vec3 current_pos = glm::vec3(0.0f, 0.0f, 0.0f);
glm::vec3 hmd_pos = glm::vec3(0.0f, 0.0f, 0.0f);
float hmd_rot = 0.0f;
float m_reset_rotation = 0.0f;
@@ -901,7 +902,8 @@ bool CMainApplication::HandleInput()
if(GetDigitalActionState( m_actionHideCubes ) || m_bResetRotation) {
printf("reset rotation!\n");
//printf("pos, %f, %f, %f\n", m_mat4HMDPose[0][2], m_mat4HMDPose[1][2], m_mat4HMDPose[2][2]);
- //m_resetPos = m_mat4HMDPose;
+ // m_resetPos = m_mat4HMDPose;
+ hmd_pos = current_pos;
m_bResetRotation = false;
m_reset_rotation = hmd_rot;
}
@@ -1987,9 +1989,9 @@ void CMainApplication::UpdateHMDMatrixPose()
case vr::TrackedDeviceClass_Controller: m_rDevClassChar[nDevice] = 'C'; break;
case vr::TrackedDeviceClass_HMD: {
//printf("pos: %f, %f, %f\n", m_rTrackedDevicePose[nDevice].mDeviceToAbsoluteTracking.m[0][3], m_rTrackedDevicePose[nDevice].mDeviceToAbsoluteTracking.m[1][3], m_rTrackedDevicePose[nDevice].mDeviceToAbsoluteTracking.m[2][3]);
- hmd_pos.x = m_rTrackedDevicePose[nDevice].mDeviceToAbsoluteTracking.m[0][3];
- hmd_pos.y = m_rTrackedDevicePose[nDevice].mDeviceToAbsoluteTracking.m[1][3];
- hmd_pos.z = m_rTrackedDevicePose[nDevice].mDeviceToAbsoluteTracking.m[2][3];
+ current_pos.x = m_rTrackedDevicePose[nDevice].mDeviceToAbsoluteTracking.m[0][3];
+ current_pos.y = m_rTrackedDevicePose[nDevice].mDeviceToAbsoluteTracking.m[1][3];
+ current_pos.z = m_rTrackedDevicePose[nDevice].mDeviceToAbsoluteTracking.m[2][3];
glm::vec3 *vec_z = (glm::vec3*)&m_rTrackedDevicePose[nDevice].mDeviceToAbsoluteTracking.m[2];
hmd_rot = atan2(vec_z->z, vec_z->x) - half_pi;