[BUG] 5.4.4 Outer Worlds 2 Object Hook list
The uobject hook list seems to be dynamic or changing and UEVR cannot recognize some objects at various times. Trying to hook a 6dof gun on the mesh, the first time it works. After changing weapon, the mesh becomes "invalid object".
At some rare times, every thing under common objects is "invalid object" including Acknowledge Pawn, Player Controller, World, etc.
It seems bool exists_unsafe(sdk::UObjectBase* object) const { return m_objects.contains(object); } returns false.
I can always find the object in lua and print out its mesh text and such. It's also one of these changing objects that has a number at the end like 723741
Wrote some lua code to hook it, which again, always works the first time: uevr.sdk.callbacks.on_early_calculate_stereo_view_offset(function(device, view_index, world_to_meters, position, rotation, is_double)
local pawn = api:get_local_pawn()
if pawn ~= nil and pawn.GetCurrentWeapon then
local equipped_weapon = pawn:GetCurrentWeapon()
if equipped_weapon ~= nil then -- Should be a UWeapon
local equipped_weapon_name = equipped_weapon:get_full_name()
if current_weapon_name ~= equipped_weapon_name then
print ("changing weapon, rerunning the attach.")
if equipped_weapon.GetActiveMeshComponent ~= nil then
local mesh = equipped_weapon:GetActiveMeshComponent() -- USkeletalMeshComponent
if mesh ~= nil then
current_weapon_name = equipped_weapon_name
print ("Attaching Mesh: ", mesh:get_full_name())
local gun_attach_hook = UEVR_UObjectHook.get_or_add_motion_controller_state(mesh)
gun_attach_hook:set_permanent(true)
gun_attach_hook:set_hand(1)
end
end
end
end
end
end)
After changing weapon, it never works again until the game is restarted. When this does work, when you go under object hooks at the top where it shows the object with the "detach" button, it has a mesh name. When it does not work, it's still attached but there's no text and just an empty "detach" button.