How to handle two overlap events to trigger only one of the two ?

Hello, I have in my game a place to produce ammo pack. When an ammo pack is produced, it falls on the ground.
When two ammo packs overlapped, they stack. One taking the ammos of the other.

It works in most cases, but there are still some bugs. I think that the best way to fix them is to make only one overlap execution for both ammo pack.

Currently, by testing, it seems that both overlap event triggers simultaneously. I tried to put a boolean that is checked and set when one is overlap to avoid this other to execute (using a branch), but it doesn’t work.

How can I trigger the overlap event of only one of the two ammo packs when they overlap ?

Thank you for your help

The one that is already set to a surface (landed) is the anchor. It should take the ammo of the other. If both are moving the one closest to world floor becomes the anchor and take the ammo of the other.

Thank you for your answer.
I didn’t understand at first your solution, so for those who would see this post later here is the solution detailled :

  1. Try to find things to compare the two objects that overlapped

  2. Then use those parameters to make only one of the two overlapped objects to validate all the boolean operations

In my case I compare the ammo count and if both have the same value I check the distance from world origin as proposed by @Rev0verDrive.

It’s now working for me, thanks for the help

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.