From 7f0e443fc20e5a2fbb812d157931f5a94cb02645 Mon Sep 17 00:00:00 2001 From: bingmapsts Date: Mon, 17 Nov 2025 14:58:28 +0200 Subject: [PATCH 1/2] RE3 weapon position --- scripts/re3_weapon_position.lua | 49 +++++++++++++++++++++++++++++++++ src/mods/FirstPerson.cpp | 3 +- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 scripts/re3_weapon_position.lua diff --git a/scripts/re3_weapon_position.lua b/scripts/re3_weapon_position.lua new file mode 100644 index 000000000..0936753ff --- /dev/null +++ b/scripts/re3_weapon_position.lua @@ -0,0 +1,49 @@ +do return end -- remove this line to enable + +if reframework:get_game_name() ~= 're3' and not vrmod:is_openxr_loaded() then + return +end + +local re2 = require('utility/RE2') + +--[[ +Common OpenVR +default: 0.2, -2.5, -1.7 +handgun: 0.2, -2.5, -1.7 + +Common OpenXR +default: 0.28, -2.982, -1.495 +handgun: 0.28, -2.982, -1.495 + +HP Reverb G2 OpenXR +default: 0.28, -2.62, -2.3 +handgun: 0, -2.62, -1.8 +]]-- +local default_right_hand_rotation_vec = Vector3f.new(0.28, -2.982, -1.495) +local handgun_right_hand_rotation_vec = Vector3f.new(0.28, -2.982, -1.495) + +-- https://github.com/SilverEzredes/Advanced-Weapon-Framework/blob/master/AWFCore/AWF/RE3R_WeaponData.lua +local handguns = {'wp0000', 'wp0100', 'wp0200', 'wp0300', 'wp0600', 'wp3000', 'wp3100'} + +re.on_pre_application_entry('UpdateBehavior', function() + if not re2.weapon then + return + end + + local weapon_gameobject = re2.weapon:call('get_GameObject') + + if not weapon_gameobject then + return + end + + local weapon_name = weapon_gameobject:call('get_Name') + + for i = 1, #handguns do + if weapon_name == handguns[i] then + firstpersonmod.right_hand_rotation_offset = handgun_right_hand_rotation_vec + return + end + end + + firstpersonmod.right_hand_rotation_offset = default_right_hand_rotation_vec +end) \ No newline at end of file diff --git a/src/mods/FirstPerson.cpp b/src/mods/FirstPerson.cpp index 71c87795e..c6a7ade49 100644 --- a/src/mods/FirstPerson.cpp +++ b/src/mods/FirstPerson.cpp @@ -231,7 +231,8 @@ void FirstPerson::on_lua_state_created(sol::state& state) { "new", sol::no_constructor, "is_enabled", &FirstPerson::is_enabled, "will_be_used", &FirstPerson::will_be_used, - "on_pre_flashlight_apply_transform", &FirstPerson::on_pre_flashlight_apply_transform + "on_pre_flashlight_apply_transform", &FirstPerson::on_pre_flashlight_apply_transform, + "right_hand_rotation_offset", &FirstPerson::m_right_hand_rotation_offset ); state["firstpersonmod"] = this; From 9857f1ee9e21913375e0fe5e527112a963a2e14a Mon Sep 17 00:00:00 2001 From: bingmapsts Date: Mon, 17 Nov 2025 16:00:24 +0200 Subject: [PATCH 2/2] RE3 weapon position --- scripts/re3_weapon_position.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/re3_weapon_position.lua b/scripts/re3_weapon_position.lua index 0936753ff..fbffaf32c 100644 --- a/scripts/re3_weapon_position.lua +++ b/scripts/re3_weapon_position.lua @@ -1,6 +1,6 @@ do return end -- remove this line to enable -if reframework:get_game_name() ~= 're3' and not vrmod:is_openxr_loaded() then +if reframework:get_game_name() ~= 're3' then return end