TTT2 Version
v0.14.6b. Directly extracted & locally ran the latest version of TTT2 base from the workshop via gmpublisher.
Description
Certain weapons do not use a standard "default" worldmodel, and instead build their worldmodel via TTT2's AddCustomWorldModel. If such a weapon is thrown on the ground and it exits the client's PVS, its rendered position will become permanently fixed where it was when it exited PVS. It will continue to render there even if the actual entity moves around, and will be rendered only if the entity's actual position is on screen.
This issue can be experienced with all base TTT2 weapons that rely on this system (radio, binoculars, decoy, beacon & visualizer). Note that the correct position/angles for the model seem to be computed at line 307 of weaponrenderer.lua, but are only applied if the hasHandBone check passes, which is impossible for thrown world-models as the "boneEnt" is no longer a player model.
Expected behavior
The worldmodel should render at the correct location/angles, i.e. those obtained from line 307 of weaponrenderer.lua.
Video (only TTT2 base & ULib/ULX installed, local server)
https://youtu.be/BWsCz34wJqQ
I used noclip to quickly showcase a PVS exit, although it's obviously possible and common in real games.
Possible fix
I was able to resolve the issue by adding the following lines to weaponrenderer.lua:
else
model:SetPos(posModel)
model:SetAngles(ang)
end
Right before model:SetMaterial(modelData.material) in weaponrenderer.Render.
I am not overall very familiar with this code, so there may be side-effects to this change that I'm not aware of.
This may also fix the symptoms of the bug & not whatever the actual bug is.
TTT2 Version
v0.14.6b. Directly extracted & locally ran the latest version of TTT2 base from the workshop via gmpublisher.
Description
Certain weapons do not use a standard "default" worldmodel, and instead build their worldmodel via TTT2's
AddCustomWorldModel. If such a weapon is thrown on the ground and it exits the client's PVS, its rendered position will become permanently fixed where it was when it exited PVS. It will continue to render there even if the actual entity moves around, and will be rendered only if the entity's actual position is on screen.This issue can be experienced with all base TTT2 weapons that rely on this system (radio, binoculars, decoy, beacon & visualizer). Note that the correct position/angles for the model seem to be computed at line 307 of
weaponrenderer.lua, but are only applied if thehasHandBonecheck passes, which is impossible for thrown world-models as the "boneEnt" is no longer a player model.Expected behavior
The worldmodel should render at the correct location/angles, i.e. those obtained from line 307 of
weaponrenderer.lua.Video (only TTT2 base & ULib/ULX installed, local server)
https://youtu.be/BWsCz34wJqQ
I used noclip to quickly showcase a PVS exit, although it's obviously possible and common in real games.
Possible fix
I was able to resolve the issue by adding the following lines to
weaponrenderer.lua:Right before
model:SetMaterial(modelData.material)inweaponrenderer.Render.I am not overall very familiar with this code, so there may be side-effects to this change that I'm not aware of.
This may also fix the symptoms of the bug & not whatever the actual bug is.