0
\$\begingroup\$

I have a project where after a certain time interval 2 NPCs are generated in different locations on the map.

Each of them collides with a collision box that defines its "class" (red or blue):

enter image description here

When 2 NPCs collide it was to be verified a condition (if the "class" of the involved ones is different) and from there both are destroyed, but nothing happens:

enter image description here

I put a print right after the Cast To NPC to see if it was happening and when they are generated the impression appears four times.

Blueprint:

enter image description here

Result in game:

enter image description here

I'd like to know how to set a cast only between two instances of the same actor.

Image showing that nothing happens when it (two instances of the same actor) collide:

enter image description here

I did the test with both codes (printing and destroying both).


EDIT 1 (I was being redundant)

In the code of destruction, I can simply put it to destroy itself only, because as it will run in both instances, the two will destroy themselves:

enter image description here

I'd still like to know how to correctly detect the collision between two instances of the same actor, but now I know that the code will be running twice, once in instance A and again in instance B.

\$\endgroup\$
  • \$\begingroup\$ Add log (to see if you get notified on collision at all) to collision also make sure that you ticked then blabla simulation generates collision events on the boxes collision properties. \$\endgroup\$ – ColdSteel Jun 3 at 4:40
  • \$\begingroup\$ I put an print right after the cast, appeared a collision with himself. What happens is that the NPC collides with a triggert at that time. \$\endgroup\$ – Boneco Sinforoso Jun 3 at 22:29
0
\$\begingroup\$

As I've said before, it's important to be careful about redundancies.

At generation time it is only to define a warrior variable in two different ways:

enter image description here

And make this comparison so that the overlapping is only detected when desired:

enter image description here

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.