Skip to content

Rendered position of world models from AddCustomWorldModel freezes after PVS exit #1874

Description

@Guy-L

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions