Skip to content

Commit

Permalink
VR: Add Sweep Movement option for Roomscale movement
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Oct 18, 2024
1 parent e1a0057 commit 602bc38
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/mods/VR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2495,6 +2495,17 @@ void VR::on_draw_sidebar_entry(std::string_view name) {
if (ImGui::TreeNode("Roomscale Movement")) {
m_roomscale_movement->draw("Enabled");

if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("When enabled, headset movement will affect the movement of the player character.");
}

ImGui::SameLine();
m_roomscale_sweep->draw("Sweep Movement");
// Draw description of option
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("When enabled, roomscale movement will use a sweep to prevent the player from moving through walls.\nThis also allows physics objects to interact with the player, like doors.");
}

ImGui::TreePop();
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/mods/VR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,10 @@ class VR : public Mod {
return m_roomscale_movement->value() && !m_aim_temp_disabled;
}

bool is_roomscale_sweep_enabled() const {
return m_roomscale_sweep->value();
}

bool is_dpad_shifting_enabled() const {
return m_dpad_shifting->value();
}
Expand Down Expand Up @@ -864,6 +868,7 @@ class VR : public Mod {
const ModToggle::Ptr m_load_blueprint_code{ ModToggle::create(generate_name("LoadBlueprintCode"), false, true) };
const ModToggle::Ptr m_2d_screen_mode{ ModToggle::create(generate_name("2DScreenMode"), false) };
const ModToggle::Ptr m_roomscale_movement{ ModToggle::create(generate_name("RoomscaleMovement"), false) };
const ModToggle::Ptr m_roomscale_sweep{ ModToggle::create(generate_name("RoomscaleMovementSweep"), true) };
const ModToggle::Ptr m_swap_controllers{ ModToggle::create(generate_name("SwapControllerInputs"), false) };
const ModCombo::Ptr m_horizontal_projection_override{ModCombo::create(generate_name("HorizontalProjectionOverride"), s_horizontal_projection_override_names)};
const ModCombo::Ptr m_vertical_projection_override{ModCombo::create(generate_name("VerticalProjectionOverride"), s_vertical_projection_override_names)};
Expand Down
4 changes: 3 additions & 1 deletion src/mods/vr/FFakeStereoRenderingHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4322,7 +4322,9 @@ __forceinline void FFakeStereoRenderingHook::calculate_stereo_view_offset(
const auto pawn_pos = pawn->get_actor_location();
const auto new_pos = pawn_pos - head_offset_flat;

pawn->set_actor_location(new_pos, false, false);
// Roomscale sweep option allows the actor to affect the world
// like push doors open, and prevent them from clipping through walls
pawn->set_actor_location(new_pos, vr->is_roomscale_sweep_enabled(), false);

// Recenter the standing origin
auto current_standing_origin = vr->get_standing_origin();
Expand Down

0 comments on commit 602bc38

Please sign in to comment.