Open karolek471 opened 2 years ago
This issue is also applicable to all physics initialization functions (ENTITY:PhysicsInit*
) when the code is running clientside. However, a workaround is available here only for the movement issues.
that's a dirty solution but it works. thank you for help but it still would be cool if it would work properly
That dirty solution doesn't work entirely if you do want to initialize it clientside as well. The clientside prop likes to 'fall' despite having its position set every tick- it likes to simulate independently of server. That bug with the workaround can be worked around by freezing just the client physobj in place.
function ENT:Think()
if CLIENT then
local physobj = self:GetPhysicsObject()
if IsValid(physobj) then
physobj:EnableMotion(false)
physobj:SetPos( self:GetPos() )
physobj:SetAngles( self:GetAngles() )
end
end
end
It sadly cannot be easily fixed because physobj info is not networked nor predicted. Most engine ents do not have clientside physobjs for this reason. The "hack" works well enough, though it should be done in a post-physics processing hook/callback rather than Think.
Details
Garry's Mod chromium branch Source Engine 24 build 8277.
Physics created with PhysicsInitConvex on server does not work on client. The clientside traces don't hit the entity. Can't use the properties menu ("C") on it. When the physics is created on both server and client the physgun grab becomes buggy but traces start to work.
Steps to reproduce