From ZDoom Wiki
Jump to navigation Jump to search


bool CanCollideWith(Actor other, bool passive)


Called when two actors may be capable of colliding are about to collide with each other. This function is called from both actors involved in the collision. The return value determines if the collision is possible between the two actors.

Note: This will only be called if regular actor blocking is not bypassed entirely with the use of flags like THRUACTORS or an object lacking SOLID while not having BLOCKEDBYSOLIDACTORS, etc.

Warning: This function assumes that the two colliding actors are the same before and after the calls. Do NOT destroy, damage, or perform any complex alterations of either actor within these calls as doing so may cause memory issues. If you need to perform checks like these when a collision occurs, then use CollidedWith instead !


  • Actor other
The actor the caller is potentially colliding with.
  • bool passive
Used to determine which actor is currently calling the function. If false, the actor that caused the collision is the current caller; otherwise the caller is the actor that is being collided with.

Return value

  • bool — determines if the two actors are allowed to collide. If one of the actors returns false, the engine will act as though the two actors didn't collide. If both return true, then standard collision behavior is used.


An actor using this code will never collide (either actively or passively) with actors that belong to the same class as it, or are based on this class:

class TestMonster : Actor
  override bool CanCollideWith(Actor other, bool passive)
    if (other is self.GetClass())
      return false;
    return Super.CanCollideWith(other, passive);

See also