Garry's Mod Wiki

Revision Difference

ENTITY:ImpactTrace#515553

<function name="ImpactTrace" parent="ENTITY" type="hook">⤶ <ishook>yes</ishook>⤶ <description>Called when a bullet trace hits this entity and allows you to override the default behavior by returning true.</description>⤶ <realm>Client</realm>⤶ <args>⤶ <arg name="traceResult" type="table">The trace that hit this entity as a &lt;page&gt;TraceResult&lt;/page&gt;.</arg>⤶ <arg name="damageType" type="number">The damage bits associated with the trace, see &lt;page&gt;DMG&lt;/page&gt;</arg>⤶ <arg name="customImpactName" type="string" default="nil">The effect name to override the impact effect with.&#xA;Possible arguments are ImpactJeep, AirboatGunImpact, HelicopterImpact, ImpactGunship.</arg>⤶ </args>⤶ <rets>⤶ <ret name="" type="boolean">Return true to override the default impact effects.</ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <description>Hides the original bullet impact effect and dispatches explosions instead.</description>⤶ <code>⤶ function ENT:ImpactTrace(trace,dmgtype,customimpactname)⤶ local effectdata = EffectData()⤶ effectdata:SetOrigin( trace.HitPos )⤶ util.Effect( "Explosion", effectdata )⤶ return true⤶ end⤶ </code>⤶ ⤶ </example>