collision
The collision
script command is used to enable or disable collisions for an entity. The command only affects NPCs and props. With collisions disabled, other entities including the player can move trough this one. For pathfinding, the nodes covered by the entity need to be enabled or disabled separately using anchorblock
.
To also hide the entity in addition to disabling collisions use objecthide
.
Usage
collision <enable>
Context: Any Entity
Parameters:
Parameter | Type | Description |
---|---|---|
enable |
bool |
Enable or disable collisions |
Collision errors
If on re-enabling collisions, the entity overlaps with other entities (that have collisions enabled) then, for each colliding entity, the collision_error_detail
event is sent asynchronously to the calling entity with the colliding entity as the sender, followed by a single collision_error
event. Asynchronous here means that the script for these events won't execute until some time after the current event completes, not during the collision
call.