diff --git a/Sources/CryGame C++/Solution1/CryGame/VRManager.cpp b/Sources/CryGame C++/Solution1/CryGame/VRManager.cpp index 97339ce..2cb1e7d 100644 --- a/Sources/CryGame C++/Solution1/CryGame/VRManager.cpp +++ b/Sources/CryGame C++/Solution1/CryGame/VRManager.cpp @@ -921,6 +921,7 @@ void VRManager::RegisterCVars() console->Register("vr_render_world_while_zoomed", &vr_render_world_while_zoomed, 1, VF_DUMPTODISK, "Keep rendering the world in VR while binoculars or weapon scopes are active - costs performance!"); console->Register("vr_binocular_size", &vr_binocular_size, 0.4f, VF_DUMPTODISK, "Width of the binocular overlay (in meters)"); console->Register("vr_scope_size", &vr_scope_size, 0.3f, VF_DUMPTODISK, "Width of the weapon scope overlay (in meters)"); + console->Register("vr_seated_mode", &vr_seated_mode, 0, VF_DUMPTODISK, "If enabled, will fix VR camera at player head height and disable physical crouching"); vr_debug_override_rh_offset = console->CreateVariable("vr_debug_override_rh_offset", "0.0 -0.1 -0.018", VF_CHEAT); vr_debug_override_lh_offset = console->CreateVariable("vr_debug_override_lh_offset", "0.0 -0.1 -0.018", VF_CHEAT); vr_debug_override_rh_angles = console->CreateVariable("vr_debug_override_rh_angles", "0.0 0.0 0.0", VF_CHEAT); diff --git a/Sources/CryGame C++/Solution1/CryGame/VRManager.h b/Sources/CryGame C++/Solution1/CryGame/VRManager.h index 61eead5..30a19fc 100644 --- a/Sources/CryGame C++/Solution1/CryGame/VRManager.h +++ b/Sources/CryGame C++/Solution1/CryGame/VRManager.h @@ -115,6 +115,7 @@ class VRManager int vr_render_world_while_zoomed; float vr_binocular_size; float vr_scope_size; + int vr_seated_mode; ICVar* vr_debug_override_rh_offset = nullptr; ICVar* vr_debug_override_rh_angles = nullptr; ICVar* vr_debug_override_lh_offset = nullptr; diff --git a/Sources/CryGame C++/Solution1/CryGame/XPlayer.cpp b/Sources/CryGame C++/Solution1/CryGame/XPlayer.cpp index 8520dba..6fad33c 100644 --- a/Sources/CryGame C++/Solution1/CryGame/XPlayer.cpp +++ b/Sources/CryGame C++/Solution1/CryGame/XPlayer.cpp @@ -2534,7 +2534,9 @@ void CPlayer::ProcessRoomscaleMovement(CXEntityProcessingCmd& ProcessingCmd) Vec3 CPlayer::GetVRBasePos() const { - if (m_pVehicle || IsSwimming() || m_pGame->IsCutSceneActive() || !IsAlive() || !IsMyPlayer()) + bool usePlayerCam = m_pVehicle || IsSwimming() || m_pGame->IsCutSceneActive() || !IsAlive() || !IsMyPlayer() || gVR->vr_seated_mode; + usePlayerCam = usePlayerCam || m_CurStance == eCrouch || m_CurStance == eProne || m_CurStance == eStealth; + if (usePlayerCam) { // use actual camera position as base Vec3 pos = m_pEntity->GetCamera()->GetPos(); @@ -2542,24 +2544,7 @@ Vec3 CPlayer::GetVRBasePos() const return pos; } - Vec3 pos = m_pEntity->GetPos(); - - float offset = 0; - switch (m_CurStance) - { - case eCrouch: - offset = m_PlayerDimCrouch.heightHead - m_hmdRefHeight; - break; - case eProne: - offset = m_PlayerDimProne.heightHead - m_hmdRefHeight; - break; - case eStealth: - offset = m_PlayerDimStealth.heightHead - m_hmdRefHeight; - break; - } - - pos.z += offset; - return pos; + return m_pEntity->GetPos(); } void CPlayer::ModifyWeaponPosition(CWeaponClass* weapon, Vec3& weaponAngles, Vec3& weaponPosition)