Garry's Mod Wiki

Entity:SetGroundEntity

  Entity:SetGroundEntity( Entity ground )

Description

Sets the ground the entity is standing on.

Arguments

1 Entity ground
The ground entity.

Example

Gives all players the ability to (sort of) walk on water.

-- shared.lua tick function GM:Tick() local trace = {} local world = Entity( 0 ) for p, ply in ipairs( player.GetAll() ) do trace = util.TraceLine( { start = ply:GetPos() + Vector( 0, 0, 72), endpos = ply:GetPos() + Vector( 0, 0, -3 ), mask = MASK_WATER, filter = function( ent ) return true end } ) if( trace.Hit ) then ply:SetGravity( 0.0001 ) ply:SetGroundEntity( world ) else ply:SetGravity( 1.0 ) end end end