Garry's Mod Wiki


boolean GM:ShouldCollide( Entity ent1, Entity ent2 )
This hook is predicted. This means that in singleplayer, it will not be called in the Client realm.


Called to decide whether a pair of entities should collide with each other. This is only called if Entity:SetCustomCollisionCheck was used on one or both entities.

Where applicable, consider using constraint.NoCollide instead - it is considerably easier to use.

This hook must return the same value consistently for the same pair of entities. If an entity changed in such a way that its collision rules change, you must call Entity:CollisionRulesChanged on that entity immediately - not in this hook.
This hook can cause all physics to break under certain conditions.

Issue Tracker: 642


1 Entity ent1
The first entity in the collision poll.
2 Entity ent2
The second entity in the collision poll.


1 boolean
Whether the entities should collide.


This should always return true unless you have a good reason for it not to.

function GM:ShouldCollide( ent1, ent2 ) -- If players are about to collide with each other, then they won't collide. if ( IsValid( ent1 ) and IsValid( ent2 ) and ent1:IsPlayer() and ent2:IsPlayer() ) then return false end -- We must call this because anything else should return true. return true end

Page Links

Special Pages



Render Time: 34ms

DB GetPage 3
Generate Html 14
SaveChanges (1) 8
Render Body 0
Render Sidebar 6