How to only interact with one actor at a time?
hi all so im doing this to interact with objects/actors in my game. But the thing is right now if theres a bunch of actors in the same place,my character interacts with all of them at the same time. What would be a good way to make sure i can only interact with one at a time?
asked Dec 11 '18 at 06:59 AM in Blueprint Scripting
Interacting with all of them is exactly what the ForEach Loop is. If you want to only interact with one, you have to either remove the ForEach Loop and select an actor otherwise, or keep the Loop and add some more checking logics after it, so that the Interact function would only apply to one at a time.
answered Dec 11 '18 at 07:25 AM
Would you could do is instead get all the actors you are overlapping from your overlap component.
Then filter by the interface.
Finally check which is closest to the center of the overlap and call interact on that.
answered Dec 11 '18 at 10:24 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here