SetGravity

Is tr.Entity:SetGravity( number ) broken because it do nothing?




TOOL.ClientConVar[ 'gravity' ] = '10'

function TOOL:LeftClick(tr)
	local gravityy	= self:GetClientInfo('gravity')
		if tr.Hit and tr.Entity and tr.Entity:IsValid() then
			tr.Entity:SetGravity( gravityy )
			return true
		end
end


By the way: should default gravity in Garry’s mod effect props/entities too? When I set it to 10, props/entities still fall it’s default falling speed.

Check out the SetGravity page on the wiki

You give it a value of 1 for full gravity, and to 0 for no gravity. No other number is accepted.

Why there isn’t half-gravity?

IT should accept any number starting from 0 till 1

*…Dude. no. I’m not gonna use that thing to toggle each individual object. Are you crazy? Please, all I want is a little checkbox below gravity settings that allow all objects to be affected or just the players. Just one little checkbox! Come on! seriously! *

100 % agree with him/her.

All Entities:



for _, ent in ipairs(ents.GetAll()) do
	ent:SetGravity(.5)
end


All players:



for _, ply in ipairs(player.GetAll()) do
	ply:SetGravity(.5)
end


Now, if you want to just change the server’s gravity, you could change it by putting this code on the server:



RunConsoleCommand("sv_gravity", GetConVarNumber("sv_gravity") / 2)