Understanding collision events
Let’s say that two objects are colliding with one another. Two things can happen:
- They overlap each other, as if the other object weren’t there, in which case the
Overlap
event is called. - They collide and prevent each other from continuing their course, in which case the
Block
event is called.
In the previous chapter, we learned how to change an object’s response to a specific Trace
channel. During this process, we learned that an object’s response can be either Block
, Overlap
, or Ignore
.
Now, let’s see what happens in each of these responses during a collision:
- Block: Two objects will only block each other if both of them have their response to the other object set to
Block
:- Both objects will have their
OnHit
events called. This event is called whenever two objects block each other’s path at the moment they collide. If one of the objects is simulating physics, that object must have...
- Both objects will have their