Help with interaction and overlap for an item

So i have IA_Interact set to pressing the F key. When i overlap an item it sets the Boolean for IsOverlappingPlayer to true, and when it leaves the overlap it sets it to false. If both are true, overlapping and interacting then destroy the actor. The issue im having is that it works on the first object fine, but the second object automatically destroys once i overlap. i never press F for the 2nd item and it destroys anyway.

1 Like

Nodes often cache the result of variables. So when you set that bool, it’s still set ready for the next item.

I think you might get better milage by putting this whole chunk of code ( or something very similar ) into the objects you are trying to interact with.

Detect the player overlap, allows input, then pressing a key will destroy. But only this object.

i thought the way i had it set up it would have separate Bools for each item instance. I guess not though i must be missing something. I can do it your way but was just trying to find a more modular way to do this for many types of items.

1 Like

i see what you mean now actually, gonna test it out later thank you again

1 Like

Modular is not in the player :slight_smile:

You can just make a BP that will do what you want. If you place 3 in the map, they will all work. That’s modular.

Also, once you learn about blueprint inheritance, you can extend the interactive object in a general way.

Sometimes stuff is in the player, like line traces for interaction, but that’s because it’s something the player is doing ( a bit like seeing ). With these interactives, your coding something the object is concerned with, that’s why the code goes in the object.