Entity/GibBreakClient

From Garry's Mod
Jump to: navigation, search
 Entity:GibBreakClient( )

Contents

Description

Causes the entity to break into its current models gibs, if it has any.

You must call Entity:PrecacheGibs on the entity before using this function, or it will not create any gibs.

If called on server, the gibs will be spawned on the currently connected clients and will not be synchronized. Otherwise the gibs will be spawned only for the client the function is called on.

Note, that this function will not remove or hide the entity it is called on.

For more expensive version of this function see Entity:GibBreakServer.

Arguments

Vector force

The force to apply to the created gibs.

Arguments

table clr=nil

If set, this will be color of the broken gibs instead of the entity's color.

Examples

Example

A console command that breaks the prop the player is aiming at when they runt he command.

concommand.Add( "break", function( ply )
	local tr = ply:GetEyeTrace()
	local ent = tr.Entity
	if ( !IsValid( ent ) ) then return end -- playing not looking at any entity, bail

	ent:PrecacheGibs()
	ent:GibBreakClient( tr.HitNormal * 100 ) -- Break in some direction
end )


Personal tools
Navigation