I have a bunch of blocks that players need to be able to work on. The problem is that those blocks only exist in Lua and not in the physics engine (and for certain reasons this is not an option.) For this reason I want to be able to disable and enable the gravity manually. Relying on sv_gravity 0 to do the job doesn’t really seem like a good idea, so I want to do it with Lua.
Currently I have the following code:
for _, ply in ipairs( player.GetAll() ) do
local vel, pos = ply:GetVelocity(), ply:GetPos()
ply:SetVelocity( Vector( -vel.x, -vel.y, -vel.z ) ) pos.z = 512.1 ply:SetPos( pos ) end
That produces the following result:
As you can see it looks a bit laggy and SetPos really isn’t the ideal solution. Does anyone know what the force is I need to apply to completely cancel the effect of gravity?