how can i check if 2 of the same actors is overlapping?

Hi
i have a problem i have been stuck on for a little while now on this problem

for context:
im trying to do a collector function with 2 different actors, 1 is called spawn point (for where the actor/collector object can spawn, and the other one is mostly visually (mesh and little bp code)
the thing spawning is good but not 100% done, because it overlapps each other, so when you pick 1, it will pick 2.

how can i check for 2 same actors that is overlapping

and when i say 2 same actors, its not spawn point actor and (coin) actor but coin actor and coin actor overlapping each other

i have tried

  • casting to coin actor only
  • check with box collision something like this
  • i have tried with actor location, heard it was bad idea

This is almost exactly what you want. Make sure this is in the coin class. Change the equals class to be the coin. Alternatively, you can use the other method you talked about (casting the other actor to coin).

Personally I’d cast, but either way is fine.

i have changed it to the right class but for some reason i cant see the print at all, i have feeling that putting collision to either overlapp all or overlapppawn could be a problem but that also a thing i think i need

Make sure your coin is overlapping whatever your coin is. In this case, the mesh is a WorldDynamic. As long as WorldDynamic (or whatever your object type is) is set to overlap, you should be good.


Of course, make sure collision is set to Collision Enabled.

Keep in mind that an overlap event won’t happen if you spawn an actor on top of (already overlapping) another actor. To fix this, you can check if there are any overlapping coins on begin play

it was not fully solution for my problem but it worked by compining get all actors with get overlapping actors, ty so much

1 Like

We all know that casts are slow to code, but comparing it to a “==”, that’s terrorist.

“The difference between casting a class and comparing it with an == to a class is that the cast also checks for inheritance, that is, if the object is of a child class or a parent class of the class to which it belongs. the cast is made. In addition, the cast allows direct access to the functions and variables of the class being cast to. The == only works for the same class, and does not allow access to anything else.”

It’s better to cast to the class you want.

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