# How to find the middle point between two vectors

**URL:** <https://forums.unrealengine.com/t/how-to-find-the-middle-point-between-two-vectors/311198>\
**Category:** Blueprint\
**Tags:** unreal-engine, vector, question, Blueprint\
**Created:** [March 16, 2015, 12:28pm UTC](https://forums.unrealengine.com/t/how-to-find-the-middle-point-between-two-vectors/311198 "2015-03-16T12:28:39Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zedrophobe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Zedrophobe](https://forums.unrealengine.com/u/Zedrophobe)\
**Post date:** [March 16, 2015, 12:28pm UTC](https://forums.unrealengine.com/t/how-to-find-the-middle-point-between-two-vectors/311198/1 "2015-03-16T12:28:39Z")

</div>

Hi, I’m trying to understand exactly how the trace by box works. I can make it work when I just input the values.

I assume it works by taking the center of the box, start and end and then adding the size (half size values) to build the box. Because I’m trying to make it work as a drag box (think any top down game/rts). I start by setting the vector location of the left mouse button when pressed and then setting the vector location when the left mouse button is released. However I can’t get the mid vector location between these. When I do a line trace from the camera (floating above the scene) to the mid point (2nd point - 1st point) it shows me a random location.

I believe its because if the locations contain a minus in any of the x, y or z axis it gives a incorrect result.

No I know there is the rama series of add-ons that will no doubt be mentioned, I’m really trying to understand how to do it without it. No sense in just accepting I can’t do it and skipping it.

Any help or even an full example of a drag box in blueprints would be a great.

---

<div class="post-metadata">

**Author:** ![Erasio](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Erasio](https://forums.unrealengine.com/u/Erasio)\
**Post date:** [March 16, 2015, 12:41pm UTC](https://forums.unrealengine.com/t/how-to-find-the-middle-point-between-two-vectors/311198/2 "2015-03-16T12:41:02Z")

</div>

2nd point - 1st point provides you with the directional vector 1st → 2nd. If you add this one to your 1st vector you will again get your second vector.

To get the middle point you have to do this ((2nd - 1st) / 2 + 1st). 2nd - 1st to get the vector between those two vectors / 2 to get the middle and + 1st to add it to the location of your first vector. Otherwise it will just start at 0, 0, 0 and therefore give a wrong result.

You might want to take a look at these:

> **[Vector intro for linear algebra (video) | Khan Academy](https://www.khanacademy.org/math/linear-algebra/vectors-and-spaces/vectors/v/vector-introduction-linear-algebra)**
>
> A vector has both magnitude and direction. We use vectors to, for example, describe the velocity of moving objects. In this video, you'll learn how to write and draw vectors.

Vector math is everything but UE related even though it’s very important for quite a large amount of stuff you want to do. Kahn academy has quite a few pretty good videos about different vector operations and you can even train it on their website!

Cheers! 🙂

---

<div class="post-metadata">

**Author:** ![Zedrophobe](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Zedrophobe](https://forums.unrealengine.com/u/Zedrophobe)\
**Post date:** [March 16, 2015, 1:05pm UTC](https://forums.unrealengine.com/t/how-to-find-the-middle-point-between-two-vectors/311198/3 "2015-03-16T13:05:29Z")

</div>

Brilliant answer, thank you so much. First answer that was simple and short but made perfect sense. Plus thank you for the link.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6fcbe82e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6fcbe82e](https://forums.unrealengine.com/u/anonymous_user_6fcbe82e)\
**Post date:** [October 8, 2015, 10:33am UTC](https://forums.unrealengine.com/t/how-to-find-the-middle-point-between-two-vectors/311198/4 "2015-10-08T10:33:11Z")

</div>

Can’t you just do (v1 + v2) / 2 ???

---

<div class="post-metadata">

**Author:** ![Erasio](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Erasio](https://forums.unrealengine.com/u/Erasio)\
**Post date:** [October 8, 2015, 12:22pm UTC](https://forums.unrealengine.com/t/how-to-find-the-middle-point-between-two-vectors/311198/5 "2015-10-08T12:22:40Z")

</div>

Indeed. I totally didn’t think of that. This is why thinking in patters is not always great.

My immediate trail of through was to get the way and half it because of how the question was asked but this is actually the straight up better way!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_7a98883a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7a98883a](https://forums.unrealengine.com/u/anonymous_user_7a98883a)\
**Post date:** [October 25, 2016, 8:17am UTC](https://forums.unrealengine.com/t/how-to-find-the-middle-point-between-two-vectors/311198/6 "2016-10-25T08:17:56Z")

</div>

You can also lerp between two vectors giving you a result somewhere between the two vectors 🙂

---

<div class="post-metadata">

**Author:** ![Darby\_Costello](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/darby_costello/32/88719_2.png) [@Darby\_Costello](https://forums.unrealengine.com/u/Darby_Costello)\
**Post date:** [February 1, 2017, 11:26am UTC](https://forums.unrealengine.com/t/how-to-find-the-middle-point-between-two-vectors/311198/7 "2017-02-01T11:26:58Z")

</div>

For anyone looking for the middle point between more than two vectors, beware: The solution above provides only the mean (average) point, not the median (centroid). For the median point, I followed this post here: [http://stackoverflow.com/questions/12934213/how-to-find-out-geometric-median](http://stackoverflow.com/questions/12934213/how-to-find-out-geometric-median)

---

<div class="post-metadata">

**Author:** ![atanknomore](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@atanknomore](https://forums.unrealengine.com/u/atanknomore)\
**Post date:** [April 3, 2017, 8:15pm UTC](https://forums.unrealengine.com/t/how-to-find-the-middle-point-between-two-vectors/311198/8 "2017-04-03T20:15:20Z")

</div>

you could also just do the following…

[http://puu.sh/v8ffZ/96bfeb8732.png](http://puu.sh/v8ffZ/96bfeb8732.png)

---

<div class="post-metadata">

**Author:** ![vanadot](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@vanadot](https://forums.unrealengine.com/u/vanadot)\
**Post date:** [May 19, 2017, 3:12am UTC](https://forums.unrealengine.com/t/how-to-find-the-middle-point-between-two-vectors/311198/9 "2017-05-19T03:12:11Z")

</div>

GetActorArrayAverageLocation / GetVectorArrayAverage ?

---

<div class="post-metadata">

**Author:** ![M\_UT\_E1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@M\_UT\_E1](https://forums.unrealengine.com/u/M_UT_E1)\
**Post date:** [July 31, 2022, 9:03pm UTC](https://forums.unrealengine.com/t/how-to-find-the-middle-point-between-two-vectors/311198/10 "2022-07-31T21:03:22Z")

</div>

![MidPoint by alpha](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/9/2/c92d1ca6181fbadafdea5bd5de5e2907cf9d528e.gif)  
I think this is the best way  
when Alpha is 0.5 we have midpoint

---

<div class="post-metadata">

**Author:** ![Kulagin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kulagin](https://forums.unrealengine.com/u/Kulagin)\
**Post date:** [March 27, 2024, 12:20pm UTC](https://forums.unrealengine.com/t/how-to-find-the-middle-point-between-two-vectors/311198/11 "2024-03-27T12:20:48Z")

</div>

Best for what? Lerp is for linear interpolation and it’s used for interpolating a value over a period of time. So this method is best to interpolate a value over a period of time between two vectors. If I just need to find a center point between those two, (v1 + v2) / 2 is much better: simpler algorithm, faster, easier to understand.

---

<div class="post-metadata">

**Author:** ![Boruki](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Boruki](https://forums.unrealengine.com/u/Boruki)\
**Post date:** [July 19, 2024, 9:52am UTC](https://forums.unrealengine.com/t/how-to-find-the-middle-point-between-two-vectors/311198/12 "2024-07-19T09:52:41Z")

</div>

Mate, this is the simplest option. Just wanted to say thank you and highlight this answer more for others who come to the thread.
