Gamemode.ShouldCollide
From GMod Wiki
Event Hook | |
Hook Name | ShouldCollide |
Syntax | GM:ShouldCollide( Entity entity1, Entity entity2 ) |
Description | Called to poll if two entities should collide. |
Returns | Boolean |
Lua State | |
BBCode | [b][url=wiki.garrysmod.com/?title=Gamemode.ShouldCollide]Gamemode.ShouldCollide [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Notes
- This hook is not called right before two entities collide, but simply to poll if they should collide when they are about to touch each other.
- If you return different values between two same entities - you can break physics engine.
- Add this to shared(shared.lua) and it'll predict when you're going to move in another player or prop.
- Returning false stops the entities colliding, returning true makes them collide.