Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions scripts/re3_weapon_position.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
do return end -- remove this line to enable

if reframework:get_game_name() ~= 're3' 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)
3 changes: 2 additions & 1 deletion src/mods/FirstPerson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down