garrysmod-issues
garrysmod-issues copied to clipboard
Physgun resets SENTs buoyancy
This has been happening for a while now, on several different branches. If you spawn an entity with it's buoyancy set via code and then handle it with the physgun, the buoyancy is reset:
self:GetPhysicsObject():SetBuoyancyRatio(.8)
However this is fixed by using a workaround hook:
hook.Add("PhysgunDrop", "SetBouyancyOnDrop", function(ply, ent)
if ent:GetClass() == "classname" then
local phys = ent:GetPhysicsObject()
timer.Simple(0, function()
if IsValid(phys) then
phys:SetBuoyancyRatio(.8)
end
end)
end
end)
I feel like it's not intended to do this so I thought I'd report it.
P.S. It also seems to be happening with the grav gun as well
This is an unfortunate reality of what PhysObj:SetMass
does. Since we can't even retrieve the buoyancy ratio from the physics engine, this cannot be fixed properly.
Ah okie, thanks for the reply, I'll just have to use my workaround hook for all of my ents that require being buoyant