Garry's Mod Wiki

Revision Difference

Entity:DropToFloor#527751

<function name="DropToFloor" parent="Entity" type="classfunc"> <description> Move an entity down until it collides with something. <warning>The entity needs to already have something below it within 256 units.</warning> </description> <realm>Server</realm> </function> <example> <description>Move all props on the server down until they collide with something</description>⤶ <description>Move all props on the server down until they collide with something.</description>⤶ <code> for _, ent in pairs( ents.FindByClass( "prop_physics" ) ) do ent:DropToFloor( ) for _, ent in ipairs( ents.FindByClass( "prop_physics" ) ) do ent:DropToFloor() end </code> </example> <example> <description>Drops players to the ground when they spawn</description>⤶ <description>Drops players to the ground when they spawn.</description>⤶ <code> hook.Add( "PlayerSpawn", "DropGround", function( ply ) ply:DropToFloor() end ) </code> ⤶ </example></example>