Garry's Mod Wiki

Garry's Mod Wiki

  ENTITY:PhysicsCollide( table colData, PhysObj collider )

Description

Called when the entity collides with anything via physics objects. The move type and solid mode must be VPHYSICS for the hook to be called.
This hook only works for anim type entities.

This is different from ENTITY:Touch.

If you want to use this hook on default/engine/non-Lua entities (like prop_physics), use Entity:AddCallback instead! This page describes a hook for Lua scripted entities

Arguments

1 table colData
Information regarding the collision. See CollisionData structure.
2 PhysObj collider
The physics object that collided.

Example

Play a sound when we hit something.

function ENT:PhysicsCollide( data, phys ) if ( data.Speed > 50 ) then self:EmitSound( Sound( "Flashbang.Bounce" ) ) end end

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...