# From point A, Get the location X units behind B

**URL:** <https://forums.unrealengine.com/t/from-point-a-get-the-location-x-units-behind-b/495931>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [February 9, 2022, 12:31am UTC](https://forums.unrealengine.com/t/from-point-a-get-the-location-x-units-behind-b/495931 "2022-02-09T00:31:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![WhiteTeapot](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@WhiteTeapot](https://forums.unrealengine.com/u/WhiteTeapot)\
**Post date:** [February 9, 2022, 12:31am UTC](https://forums.unrealengine.com/t/from-point-a-get-the-location-x-units-behind-b/495931/1 "2022-02-09T00:31:42Z")

</div>

Given the 2 locations _A_ and _B_. How would you get the location of _C_ ?  
_C_ being a point _X_ units “behind” Point _B_ from the direction of _A_?

![ABCX](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/a/8/ea8514e605594922cbeda9347e5362bb34165166.jpeg)

Sadly this has already seems to have been answered in 2016…

> [@Starting from point A, get location X distance along given direction](https://forums.unrealengine.com/t/starting-from-point-a-get-location-x-distance-along-given-direction/344336):
>
> We have 2 points. Point A and Point B. We want to create a new point (Point C) that is located 100 units away from point A in the direction of point B. GetDirectionVector will give me the direction from Point A to Point B. How do i actually work out the position 100 units along that direction starting from Point A. Thanks guys, Vector math is the bane of my existence ;).

but the link to the answer has broken? and now points to an unanswered question about swarm…

---

<div class="post-metadata">

**Author:** ![WhiteTeapot](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@WhiteTeapot](https://forums.unrealengine.com/u/WhiteTeapot)\
**Post date:** [February 9, 2022, 1:23am UTC](https://forums.unrealengine.com/t/from-point-a-get-the-location-x-units-behind-b/495931/2 "2022-02-09T01:23:51Z")

</div>

Rubber Ducky Answer

 ![BPVectorABCX](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/d/2/2d21ad959f2b7f581d03d31474749029293f5538.jpeg)

![ABCX_video](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/1/e/a1e5bdfa347f91ef3a36f3dae35b2215588f2bba.gif)

I created a BP with 3 cubes, Point A, B, C.

My method begins with putting the world location of A and B into a GetUnitDirection (Vector) Node.  
You then multiply the return vector by the X units “behind” you desire.  
This value must then be added to the world location of Point B.  
I’m teleporting Point C to this location for demonstration.

Thanks pezzott1 for explaining

> [@From point A, Get the location X units behind B](https://forums.unrealengine.com/t/from-point-a-get-the-location-x-units-behind-b/495931/3):
>
> Get Unit Direction Vector gets the direction vector of length 1 that aims from A to B. The scalar XUnits is offseting that vector by multiplying its value. You then add the offsetted vector with the B wolrd location to place C. Basical its: get direction from A to B and move X Units in that direction starting from B location.

---

<div class="post-metadata">

**Author:** ![pezzott1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pezzott1/32/1215068_2.png) [@pezzott1](https://forums.unrealengine.com/u/pezzott1)\
**Post date:** [February 9, 2022, 1:53am UTC](https://forums.unrealengine.com/t/from-point-a-get-the-location-x-units-behind-b/495931/3 "2022-02-09T01:53:54Z")

</div>

> [@WhiteTeapot](#):
>
> The only problem remaining is that I cannot properly explain why this works.

Get Unit Direction Vector gets the direction vector of length 1 that aims from A to B.

The scalar XUnits is offseting that vector by multiplying its value.

You then add the offsetted vector with the B wolrd location to place C.

Basical its: get direction from A to B and move X Units in that direction starting from B location.

---

<div class="post-metadata">

**Author:** ![WhiteTeapot](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@WhiteTeapot](https://forums.unrealengine.com/u/WhiteTeapot)\
**Post date:** [February 9, 2022, 2:03am UTC](https://forums.unrealengine.com/t/from-point-a-get-the-location-x-units-behind-b/495931/4 "2022-02-09T02:03:16Z")

</div>

Thanks friend. I’m going to throw in a bunch of search terms as this was a really difficult problem to search for.

Get location behind player from other character.  
How to get a location behind an actor set distance away. Location behind player from point. Facing direction behind point. Facing direction behind actor. Find point behind other actor. Get a point distance away from another point. Find location behind character from another character.

---

<div class="post-metadata">

**Author:** ![pezzott1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pezzott1/32/1215068_2.png) [@pezzott1](https://forums.unrealengine.com/u/pezzott1)\
**Post date:** [February 9, 2022, 2:13am UTC](https://forums.unrealengine.com/t/from-point-a-get-the-location-x-units-behind-b/495931/5 "2022-02-09T02:13:07Z")

</div>

> [@WhiteTeapot](#):
>
> Get location behind player from other character.  
> How to get a location behind an actor set distance away. Location behind player from point. Facing direction behind point. Facing direction behind actor. Find point behind other actor. Get a point distance away from another point. Find location behind character from another character.

This looks like problems to solve using the Dot Product. 😉

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/5/e/c5eb723dc5d0053721a11a683d3294fa7545c31b.jpeg "Dot") ](https://www.youtube.com/watch?v=5016l1ubnUE)
