View post on imgur.com
There’s my logic, I’m not sure why it’s not choosing an actor to move to.
View post on imgur.com
There’s my logic, I’m not sure why it’s not choosing an actor to move to.
Hi Phillipjphry,
how about after “get all actor of class” you loop through the returned array, for each actor, get the distance between the pawn and the actor (location.pawn minus location.actor → length), store that length as current shortest and store the index of that actor. Now the iteration continues, next actor, check if the distance is smaller, if yes, store the value as current shortest and the actor index as the target, if not, just move to next. After you have looped through the array, you have the distance and index of the closes actor. Not sure how often you plan on executing this and how many actor you have but it should work.
Regards,
And I see that your “get AI Controller” is not connected to any execution pin, so this function won’t be called.
Yeah, that was me being disorganized.
Thanks so much! And I made a small task afterwards with a passed actor reference to delete the actor moved to when the move was done. Now I just need to wrap my brain around your answer. I want to see if I can make it go to the furthest as well. Then everywhere inbetween.