I couldn’t think of a good title, but basically what I have on my character is a capsule collider that is the pickup area, any items that collide with it can be picked up, when that collider is overlapping with my pickup parent actor it lets me know that there is an item that can be picked up, and when the use key is pressed it will let me know that the item has been picked up and it will destroy the actor, all of that works well and as intended, unfortunately there is a problem when there is more than one item inside the pickup collider, while it does seem to know that there is more than one item there, it will only destroy one when use is pressed, to destroy the other I will have to reset the overlap by moving away and going back again…
You can see from those screenshots that it’s nothing really complicated, Is it possibly because the OnComponentBeginOverlap node doesn’t refresh every tick and is only fired once the overlap takes place?
I can’t really think of a way to get around this, so any help or pointers would be very much appreciated.
I think it might be easier if, instead of using a Pickup bool, you instead add the OtherActor/Target to an array/list of actors during BeginOverlap. Then when you press the button, you iterate through your list destroying all the actors in it?
You would also need to remove the OtherActor/Target from the array during EndOverlap too.
You could perhaps use a ForEachLoopWithBreak, and have the arrow coming out of Destroy Actor feed into Break - that way it’ll stop iterating after it’s destroyed the first one(?)
EDIT: Also, you shouldn’t need your Pickup bool now, you should be able to remove that and the Branch condition to clean the blueprint up a bit (just incase that’s still affecting anything). You could just move the Print String to after the Destroy Actor node.
This is a quick version I’ve just knocked up. Each individual key press results in the user picking up an item. Are you sure both your items are Tagged correctly? It may be worth stripping your blueprint down to it’s simplest implementation to see if there’s anything unnecessary that’s affecting it.
No problem, Recker Yes, each time a ForLoop node is reached it’ll start iterating again from Index 0 and although you are destroying the actor from the world it’ll still be taking up space at Index 0 in the array unless you remove it too.