Within range

Hello, i’m on version 4.18.
calculating the difference between the actor location and the target location is returning more than 300 when the AI reaches to his move location. i dont know why. accaptance radius and withing rage parameters are both set to 300.
when i changed withing range parameter to 400 it worked.

aside of that, i think this installation might be better, since shooting is a never ending task

2 Likes

Thanks man, this really helped me out!

For anybody else that runs into this issue, I dug into the project a little to find the source of the issue. The distance formula is finding the difference between the two actors’ origins while the MoveTo node uses the difference between the actors’ collision capsules which, in the default case, has a radius of 45. The simple solution is just as @omer_keidar did, set a difference of more than 90 between the acceptance radius and the range parameter.

A more complicated method involves a line trace starting from the AI’s capsule and ending at the player’s location. The resulting distance, “Out Hit Distance”, will be approximately equal to the distance used in the MoveTo node.

Here’s a sample “complicated” solution:


*Adding 1 to the capsule radius accounts for rounding used in the MoveTo acceptance radius

This is the resulting line trace. Notice how the trace originates at the AI’s collision capsule and ends at the player’s collision capsule.

3 Likes

Thanks. This helped me as well.

Hah, I suspected it might be this and am relieved that someone else came to the same conclusion. :sweat_smile:

Privacy & Terms