Thanks for replying!
Well, for start the spheres disappear after a few seconds but the lines remain, (I made it that way) that’s why there is no sphere everywhere.
As for the distances, I manually moved a character closer (click and drag), but even then it was not being registered as the closest actor, certainly not consistently.
It is a bit confusing.
Oh, okay! That makes sense.
Well, can you show the EVENT that is causing the line traces? If you’re not doing it on tick, or if you’re allowing tick at a slower rate, it’s not going to update constantly. If you’re doing the loop like I suggested above, depending on the timer’s time variable it could be a long time.
Ι have tested your method and the results were pretty much the same as I remember.
Here is what I’m doing. It is an event that’s being called everytime the AI perception is updated.
Ah, AI MoveTo may be not getting updated- Since you’re not using the On Success/Fail outputs, I’d suggest using MoveToLocation.
The clock on AI MoveTo along with those inputs has a strange interaction, I don’t remember exactly but that may be the issue with your re-draw of the circle.
One way you could test that is bypassing the AI MoveTo node, going from “GetClosestObject” straight to the debug sphere, then moving your units around manually to see if they redraw!
Thank you very much!
Even though drawing lines and spheres is not my problem in that particular instance.
It is that the AI perception is registering specific actors as being the closest and ignoring others.
Hence the clustering that you see. I mean that whatever is being drawn corresponds with the AI movement.
I’m unsure if I understood your explanation correctly, but I think you’ve meant this.
I’m not sure, actually. What you’ve said here seems to be what I understood you were saying before. The idea of bypassing the AI MoveTo and going straight to the draws was to absolutely confirm what you’re thinking is happening.
Also, now that I think about it, you can’t use OnPerceptionUpdated for this, if the AI can see everything. OnPerceptionUpdated doesn’t activate on movement, like I think you may be thinking. It activates on a change of STATE for the perception. So it would run the event when something that is perceived enters or exits view distance and ONLY return actors that changed perception state (see/do not see) as an array.
Therefore, using OnPerceptionUpdated is only running one time, at the beginning of your simulation, because both armies see both armies at the beginning, and nobody is going out of range of sight or entering range of sight! Eureka!
Also- Updated actors as an Array might only be returning any actors that are updated- we may need to think of a way to have an array of all actors in one army vs another army, and have the AI’s draw on those arrays for their distance checks! Maybe you could use the GameMode, do a GetAllActorsOfClass on beginplay, and sort them by tag into two armies.
Let me know what you think about that!
1 Like
I’ll test it and let you know if I get any results.
I have already used the “On Pawn Sense” but the results were pretty much the same.
Thank you very much for your continuous help though, I really appreciate it!
1 Like
Oh, definitely don’t use OnPawnSense because that is just using the simpler version of the AI sense component known as “PawnSense”- so yeah, it will return the exact same thing as OnPerceptionUpdated, they’re extremely similar.
You’ll need to use a timer to update the closest sensed pawn, or use tick while TESTING (only while testing! This would get very heavy in full game!)
1 Like