# How to scale along non X,Y, or Z direction

**URL:** <https://forums.unrealengine.com/t/how-to-scale-along-non-x-y-or-z-direction/324926>\
**Category:** Community & Industry Discussion\
**Tags:** actor, direction, unreal-engine, vector, scale, question\
**Created:** [July 12, 2015, 2:26am UTC](https://forums.unrealengine.com/t/how-to-scale-along-non-x-y-or-z-direction/324926 "2015-07-12T02:26:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marthius\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Marthius\_1](https://forums.unrealengine.com/u/Marthius_1)\
**Post date:** [July 12, 2015, 2:26am UTC](https://forums.unrealengine.com/t/how-to-scale-along-non-x-y-or-z-direction/324926/1 "2015-07-12T02:26:42Z")

</div>

I need to make an object (simple sphere) scale along a non-cardinal direction. This is not the same as simply scaling along a combination of directions.

For example, scaling along a vector half way between the x and y axis vs. scaling equally in the X and Y direction.

 ![49931-scale.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/c/3/2c358ddf7f7f7a054bbde76244f135f5c44308d2.png)

In the above image, the top figure would be the source object, the left figure is what I want to achieve (scale along a custom direction) and the right figure is what i get if I scale along the x and y directions individually.

---

<div class="post-metadata">

**Author:** ![AnilKaratas\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AnilKaratas\_1](https://forums.unrealengine.com/u/AnilKaratas_1)\
**Post date:** [July 12, 2015, 4:01am UTC](https://forums.unrealengine.com/t/how-to-scale-along-non-x-y-or-z-direction/324926/2 "2015-07-12T04:01:08Z")

</div>

i don’t get the problem here, why not just rotate that sphere however you want to, and then scale like that, scale takes the local object space directions of the object not the world space.

---

<div class="post-metadata">

**Author:** ![Marthius\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Marthius\_1](https://forums.unrealengine.com/u/Marthius_1)\
**Post date:** [July 12, 2015, 4:40am UTC](https://forums.unrealengine.com/t/how-to-scale-along-non-x-y-or-z-direction/324926/3 "2015-07-12T04:40:01Z")

</div>

The issue is that the scaling must be dynamic (based on the velocity and direction of a player controlled pawn) and the object must remain fixed in space and rotation.

This is necessary to represent a special physics effect called a Lorentz contraction

---

<div class="post-metadata">

**Author:** ![ScottSpadea](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/scottspadea/32/1194682_2.png) [@ScottSpadea](https://forums.unrealengine.com/u/ScottSpadea)\
**Post date:** [July 12, 2015, 1:48pm UTC](https://forums.unrealengine.com/t/how-to-scale-along-non-x-y-or-z-direction/324926/4 "2015-07-12T13:48:41Z")

</div>

you could try making a vertex shader with worldPositionOffset, and a custom shader node, where you multiply matrix transformations in HLSL. you would need to rotate the mesh, scale it along a world axis, then rotate it back… but im not sure how to scale things along a world axis in UE4.

---

<div class="post-metadata">

**Author:** ![Marthius\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Marthius\_1](https://forums.unrealengine.com/u/Marthius_1)\
**Post date:** [July 13, 2015, 1:48am UTC](https://forums.unrealengine.com/t/how-to-scale-along-non-x-y-or-z-direction/324926/5 "2015-07-13T01:48:35Z")

</div>

The worldPositionOffset was the key!

Here is the material which eventually did the trick in case anyone else needs it.alt text

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_c6f67f901](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c6f67f901](https://forums.unrealengine.com/u/anonymous_user_c6f67f901)\
**Post date:** [November 7, 2017, 12:03am UTC](https://forums.unrealengine.com/t/how-to-scale-along-non-x-y-or-z-direction/324926/6 "2017-11-07T00:03:21Z")

</div>

Thank you so much for that link! It saved me after 4 hours of searching for a technique to do this.

---

<div class="post-metadata">

**Author:** ![blacehoule](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@blacehoule](https://forums.unrealengine.com/u/blacehoule)\
**Post date:** [January 27, 2023, 5:58pm UTC](https://forums.unrealengine.com/t/how-to-scale-along-non-x-y-or-z-direction/324926/7 "2023-01-27T17:58:45Z")

</div>

I’m coming to this thread a bit late, but I am trying to achieve the same thing. The link you shared no longer works. Can anyone provide some more information on how worldPositionOffset can be used to create the Lorentz contraction effect? Any help would be much appreciated.

---

<div class="post-metadata">

**Author:** ![Santaiko](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Santaiko](https://forums.unrealengine.com/u/Santaiko)\
**Post date:** [August 30, 2024, 1:08pm UTC](https://forums.unrealengine.com/t/how-to-scale-along-non-x-y-or-z-direction/324926/8 "2024-08-30T13:08:17Z")

</div>

Link still doesnt work, could you give us an updated one?
