fix vr head and controller pos
This commit is contained in:
@@ -91,7 +91,7 @@ void Vive::Update()
|
||||
h.m[0][3], h.m[1][3], h.m[2][3], 1,
|
||||
};
|
||||
|
||||
if (!m_position_valid)
|
||||
if (current_pose.bPoseIsValid && !m_position_valid)
|
||||
{
|
||||
m_initial_position = { h.m[0][3], h.m[1][3], h.m[2][3] };
|
||||
m_position_valid = true;
|
||||
@@ -102,7 +102,7 @@ void Vive::Update()
|
||||
auto mat_eye = glm::inverse(glm::make_mat4(data_eye_pose));
|
||||
|
||||
m_proj[eye] = mat_proj;
|
||||
m_view[eye] = mat_eye * mat_pose * glm::translate(m_initial_position);
|
||||
m_view[eye] = mat_eye * mat_pose/* * glm::translate(m_initial_position)*/;
|
||||
m_pose = glm::make_mat4(data_hmd_pose);
|
||||
|
||||
// invalidate controller state
|
||||
@@ -125,7 +125,7 @@ void Vive::Update()
|
||||
{
|
||||
m_controllers[controller_index].m_valid = true;
|
||||
m_hmd->GetControllerState(id, &m_controllers[controller_index].m_state, sizeof(vr::VRControllerState_t));
|
||||
m_controllers[controller_index].m_mat = glm::translate(-m_initial_position) * Pose2Mat(poses[id].mDeviceToAbsoluteTracking);
|
||||
m_controllers[controller_index].m_mat = /*glm::translate(-m_initial_position) * */Pose2Mat(poses[id].mDeviceToAbsoluteTracking);
|
||||
|
||||
auto pressed_mask = m_controllers[controller_index].m_state.ulButtonPressed;
|
||||
for (uint8_t bi = 0; bi < (uint8_t)ViveController::kButton::COUNT; bi++)
|
||||
|
||||
Reference in New Issue
Block a user