ENTITY:ImpactTrace

From Garry's Mod
Jump to: navigation, search
 ENTITY:ImpactTrace( )

Contents

Description

Called when a bullet trace hits this entity and allows you to override the default behavior by returning true.

Arguments

table traceResult

The trace that hit this entity as a TraceResult structure.

Arguments

number damageType

The damage bits associated with the trace, see DMG_ Enums

Arguments

string customImpactName=nil

The effect name to override the impact effect with.

Possible arguments are ImpactJeep, AirboatGunImpact, HelicopterImpact, ImpactGunship.

Returns

boolean

Return true to override the default impact effects.

Examples

Example

Hides the original bullet impact effect and dispatches explosions instead.

function ENT:ImpactTrace(trace,dmgtype,customimpactname)
	local effectdata = EffectData()
	effectdata:SetOrigin( trace.HitPos )
	util.Effect( "Explosion", effectdata )
	return true
end


Personal tools
Navigation