Garry's Mod Wiki

Revision Difference

ENTITY:PhysicsCollide#518308

<function name="PhysicsCollide" parent="ENTITY" type="hook"> <ishook>yes</ishook> <description> Called when the entity collides with anything. The move type and solid type must be VPHYSICS for the hook to be called. <note>If you want to use this hook on default/engine/non-Lua entites ( like prop_physics ), use <page>Entity:AddCallback</page> instead! This page describes a hook for Lua entities</note> </description> <realm>Server</realm> <predicted>No</predicted> <args> <arg name="colData" type="table">Information regarding the collision. See &lt;page&gt;CollisionData&lt;/page&gt;.</arg> <arg name="colData" type="table">Information regarding the collision. See <page>CollisionData</page>.</arg> <arg name="collider" type="PhysObj">The physics object that collided.</arg> </args> </function> <example> <description>Play a sound when we hit something.</description> <code> function ENT:PhysicsCollide( data, phys ) if ( data.Speed &amp;gt; 50 ) then self:EmitSound( Sound( "Flashbang.Bounce" ) ) end if ( data.Speed &gt; 50 ) then self:EmitSound( Sound( "Flashbang.Bounce" ) ) end end </code> </example>