# Offset vectors

**URL:** <https://forums.unrealengine.com/t/offset-vectors/476603>\
**Category:** Rendering\
**Tags:** offset, unreal-engine, geometry, question, vectors\
**Created:** [December 31, 2020, 11:32am UTC](https://forums.unrealengine.com/t/offset-vectors/476603 "2020-12-31T11:32:42Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mateusz88](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mateusz88](https://forums.unrealengine.com/u/Mateusz88)\
**Post date:** [December 31, 2020, 11:32am UTC](https://forums.unrealengine.com/t/offset-vectors/476603/1 "2020-12-31T11:32:42Z")

</div>

Hi I’d like to offset vectors like in the image. Any ideas to do that

 ![325997-offsetvector.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/2/6/e264384e6d4752f2ee00327c2f4735702f5a9e8f.jpeg)

???

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [December 31, 2020, 12:12pm UTC](https://forums.unrealengine.com/t/offset-vectors/476603/2 "2020-12-31T12:12:18Z")

</div>

Can you be a bit more specific? Generally speaking, to offset a vector, you would add another vector to it.

---

<div class="post-metadata">

**Author:** ![Mateusz88](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mateusz88](https://forums.unrealengine.com/u/Mateusz88)\
**Post date:** [December 31, 2020, 12:21pm UTC](https://forums.unrealengine.com/t/offset-vectors/476603/3 "2020-12-31T12:21:23Z")

</div>

Something like this :[link text](https://www.youtube.com/watch?v=lVzGU6LzhT0&feature=youtu.be)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [December 31, 2020, 2:43pm UTC](https://forums.unrealengine.com/t/offset-vectors/476603/4 "2020-12-31T14:43:19Z")

</div>

Ok, like inset face in blender? But what do you want to do it to? A mesh? A texture?..

---

<div class="post-metadata">

**Author:** ![Mateusz88](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mateusz88](https://forums.unrealengine.com/u/Mateusz88)\
**Post date:** [December 31, 2020, 2:47pm UTC](https://forums.unrealengine.com/t/offset-vectors/476603/5 "2020-12-31T14:47:25Z")

</div>

I want to offset locations of building to spawn them from roads.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [December 31, 2020, 2:50pm UTC](https://forums.unrealengine.com/t/offset-vectors/476603/6 "2020-12-31T14:50:21Z")

</div>

Are you roads splines? X is forward, so the left and right of the road would be offsets in Y.

---

<div class="post-metadata">

**Author:** ![Mateusz88](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mateusz88](https://forums.unrealengine.com/u/Mateusz88)\
**Post date:** [December 31, 2020, 2:55pm UTC](https://forums.unrealengine.com/t/offset-vectors/476603/7 "2020-12-31T14:55:35Z")

</div>

Yes but its hard to determine in cross roads. So for my case its good to specify at least three points a then offset to inside them like inset in blender. But hard for me to calculate it.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [December 31, 2020, 4:19pm UTC](https://forums.unrealengine.com/t/offset-vectors/476603/8 "2020-12-31T16:19:56Z")

</div>

I might be able to help, but I need to see what you have so far…

---

<div class="post-metadata">

**Author:** ![Mateusz88](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mateusz88](https://forums.unrealengine.com/u/Mateusz88)\
**Post date:** [December 31, 2020, 4:43pm UTC](https://forums.unrealengine.com/t/offset-vectors/476603/9 "2020-12-31T16:43:34Z")

</div>

So I’ve made Idea What it should look like. There is no blueprinting yet just I took vertices from procedural mesh and manuely attached spline points.

 ![326005-idea.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/5/1/051692d00b9431be417038ae97c4b27133128f8f.jpeg)

---

<div class="post-metadata">

**Author:** ![Mattk50](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mattk50](https://forums.unrealengine.com/u/Mattk50)\
**Post date:** [December 31, 2020, 5:04pm UTC](https://forums.unrealengine.com/t/offset-vectors/476603/10 "2020-12-31T17:04:46Z")

</div>

If you just need to calculate the point, you should create a function that does scaling.

For any scaling you need a pivot point so your function should probably take in a pivot input then an array of the points, and the scale factor. Then you just subtract all the point locations by the pivot location, then multiply those new vectors by the scaling factor (which is a float) and then add the pivot location to all the vectors again. Then return the array of new points and that should be what you need.

To find the pivot for that image example you posted in a comment, you could just average those vectors to get the center point (add them up and divide by the number of vectors, 3 in this case)

---

<div class="post-metadata">

**Author:** ![Mateusz88](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mateusz88](https://forums.unrealengine.com/u/Mateusz88)\
**Post date:** [December 31, 2020, 5:13pm UTC](https://forums.unrealengine.com/t/offset-vectors/476603/11 "2020-12-31T17:13:19Z")

</div>

Thanks, for hint it will work but with pivot point. Ideal for me would be without it because i need function like inset in blender Clockwork Ocean mentioned. Pivot point will have to be calculate also .

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [December 31, 2020, 5:26pm UTC](https://forums.unrealengine.com/t/offset-vectors/476603/12 "2020-12-31T17:26:13Z")

</div>

Yes, you can scale in given those 3 points. Let me think a bit. The pivot needs to be in the center for it to work.

I think it could just be the average of the 3 vectors ( ignoring Z ).

If it’s not that, you might just want to find an easier way of doing it:

> <https://math.stackexchange.com/questions/2969363/finding-a-4th-point-in-3d-space-knowing-3-other-points-and-2-distances-to-the-4t>

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [December 31, 2020, 5:42pm UTC](https://forums.unrealengine.com/t/offset-vectors/476603/13 "2020-12-31T17:42:41Z")

</div>

Yeah, it’s just the average of the vectors:

 ![326008-screenshot-1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/1/0/5101e70512765069148f90da7d4dd3add161d35c.jpeg)

![326009-3points.gif](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/9/5/995628f3915c659d7c775b43a6665c5499778a49.gif)

---

<div class="post-metadata">

**Author:** ![Mateusz88](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mateusz88](https://forums.unrealengine.com/u/Mateusz88)\
**Post date:** [December 31, 2020, 6:06pm UTC](https://forums.unrealengine.com/t/offset-vectors/476603/14 "2020-12-31T18:06:08Z")

</div>

IT WORKS THANK YOU FOR HELP !!!

---

<div class="post-metadata">

**Author:** ![Mateusz88](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mateusz88](https://forums.unrealengine.com/u/Mateusz88)\
**Post date:** [December 31, 2020, 6:07pm UTC](https://forums.unrealengine.com/t/offset-vectors/476603/15 "2020-12-31T18:07:06Z")

</div>

THANK YOU FOR HELP !!!
