# Vector math

I’m not the greatest with vector math so I’m hoping someone smarter than I can help me find the right formula for this.

What I need to do is get my AI to move towards a target (which is not at a set angle from the AI) but I don’t want it to go exactly to the target. Instead I need it to stop a given distance from the target (let’s say 2000 units for this example.). Simply subtracting 2000 from the X of the Get Actor Location of the target doesn’t work as I expect because the coordinates are along bother the X/Y axis. This tells me I need to use a relative location which I guess would technically make it a subtraction of 2000 from the X.

How can I get the world location that lies between my AI and the target that is 2000 units away from the target so that I can set that as my AI’s move to location?

Hope I didn’t confuse anyone here! Your help is GREATLY appreciated!

You need to get a direction vector form the target to the starting location normalize it then multiply it by 2000.

Could you elaborate further? I’ll check into the direction vector and play around with it. Normalizing it, then multiplying it by 2000 would give me 2000 units from the “From” or “To” vector?

I’ve tried this a couple ways and each way gives the same result - The NPC move towards 0,0,0 to ~2000 units away from it. They do not go towards the intended target. Am I doing something wrong with it or?? In the image, the top “get actor location” is the intended target and the bottom is the AI/NPC.

So i think your best bet is to get the target location, and you going to use (vector + vector) and if you want the ai to move to the target for the top node of (vector + vector) you will plug the target location, for the 2nd part you will set X at 2,000. Then you will say “ai move to” and plug the result from vector + vector node to the location of where you want the ai to move to.