The event fired when leaving a trigger volume (triggerleave) returns the entity only that exits the volume:
https://developer.playcanvas.com/en/api/pc.CollisionComponent.html#event:triggerleave
So to do that you will have to code some basic maths:
- Get the position of the trigger volume
- Get the position of the entity leaving the volume
- Find the angle between the two points to understand the direction the object is leaving from.
Helpful thread on how to find the angle given two vectors (your positions):