Skip to content

Commit

Permalink
Experimental: Add Use Actor Rotation for roomscale
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Aug 22, 2023
1 parent 94afda7 commit 04a7eb8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/mods/VR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2024,6 +2024,7 @@ void VR::on_draw_ui() {
ImGui::SetNextItemOpen(true, ImGuiCond_::ImGuiCond_Once);
if (ImGui::TreeNode("Roomscale Movement")) {
m_roomscale_movement->draw("Enabled");
m_roomscale_movement_actor_rotation->draw("Use Actor Rotation");

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

bool is_roomscale_using_actor_rotation() const {
return m_roomscale_movement_actor_rotation->value();
}

private:
Vector4f get_position_unsafe(uint32_t index) const;
Vector4f get_velocity_unsafe(uint32_t index) const;
Expand Down Expand Up @@ -662,6 +666,7 @@ class VR : public Mod {
const ModToggle::Ptr m_load_blueprint_code{ ModToggle::create(generate_name("LoadBlueprintCode"), false) };
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_movement_actor_rotation{ ModToggle::create(generate_name("RoomscaleMovementActorRotation"), false) };

// Aim method and movement orientation are not the same thing, but they can both have the same options
const ModCombo::Ptr m_aim_method{ ModCombo::create(generate_name("AimMethod"), s_aim_method_names, AimMethod::GAME) };
Expand Down Expand Up @@ -726,6 +731,7 @@ class VR : public Mod {
*m_load_blueprint_code,
*m_2d_screen_mode,
*m_roomscale_movement,
*m_roomscale_movement_actor_rotation,
*m_aim_method,
*m_movement_orientation,
*m_aim_speed,
Expand Down
11 changes: 11 additions & 0 deletions src/mods/vr/FFakeStereoRenderingHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4062,6 +4062,17 @@ __forceinline void FFakeStereoRenderingHook::calculate_stereo_view_offset(
current_standing_origin.x = hmd_pos.x;
current_standing_origin.z = hmd_pos.z;
vr->set_standing_origin(current_standing_origin);

// testing
if (vr->is_roomscale_using_actor_rotation()) {
if (!has_double_precision) {
pawn->set_actor_rotation(*(glm::vec3*)view_rotation, false);
} else {
pawn->set_actor_rotation(glm::vec3{rot_d->pitch, rot_d->yaw, rot_d->roll}, false);
}

vr->recenter_view();
}
}
}
}
Expand Down

0 comments on commit 04a7eb8

Please sign in to comment.