# Rotate mesh through material using World Position Offset

**URL:** <https://forums.unrealengine.com/t/rotate-mesh-through-material-using-world-position-offset/435912>\
**Category:** Rendering\
**Tags:** rotation, world-position-offse, unreal-engine, question\
**Created:** [October 18, 2018, 6:56pm UTC](https://forums.unrealengine.com/t/rotate-mesh-through-material-using-world-position-offset/435912 "2018-10-18T18:56:42Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![blink7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@blink7](https://forums.unrealengine.com/u/blink7)\
**Post date:** [October 18, 2018, 6:56pm UTC](https://forums.unrealengine.com/t/rotate-mesh-through-material-using-world-position-offset/435912/1 "2018-10-18T18:56:42Z")

</div>

Hi there,

I’m trying to rotate a mesh (box) around different axises, but I’m not good in this… For now I can only rotate separately by Y or Z, but when I change angles around both axises at the same time, the mesh is getting a weird shape.

How do I need to combine these operations properly?

 ![256968-snip-20181018214552.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/8/3/48316cf9c8a7f56a4881a253801dc7f28122012c.png)

 ![256970-snip-20181018215544.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/5/0/e50ba7287722e4b6315ab4dd84c33b1be35255d8.png)

---

<div class="post-metadata">

**Author:** ![bstt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@bstt](https://forums.unrealengine.com/u/bstt)\
**Post date:** [January 16, 2019, 6:58pm UTC](https://forums.unrealengine.com/t/rotate-mesh-through-material-using-world-position-offset/435912/2 "2019-01-16T18:58:07Z")

</div>

Hello,

Use **Object Position** instead of **Absolute World Position** , this should work better.

_Absolute World Position is a different position for each pixel of your mesh whereas Object Position is the position of your mesh, therefore the same for each pixel._

---

<div class="post-metadata">

**Author:** ![blink7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@blink7](https://forums.unrealengine.com/u/blink7)\
**Post date:** [February 2, 2019, 10:45am UTC](https://forums.unrealengine.com/t/rotate-mesh-through-material-using-world-position-offset/435912/3 "2019-02-02T10:45:14Z")

</div>

No, this didn’t help. Even more, with **Object Position** my mesh no longer rotates…

---

<div class="post-metadata">

**Author:** ![Deathrey](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Deathrey](https://forums.unrealengine.com/u/Deathrey)\
**Post date:** [February 2, 2019, 12:50pm UTC](https://forums.unrealengine.com/t/rotate-mesh-through-material-using-world-position-offset/435912/4 "2019-02-02T12:50:35Z")

</div>

Supply rotation matrix and transform world position using it.

---

<div class="post-metadata">

**Author:** ![blink7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@blink7](https://forums.unrealengine.com/u/blink7)\
**Post date:** [February 2, 2019, 3:28pm UTC](https://forums.unrealengine.com/t/rotate-mesh-through-material-using-world-position-offset/435912/5 "2019-02-02T15:28:35Z")

</div>

Can you please provide a little bit more details about how to properly combine these ones to achieve desired effect?

---

<div class="post-metadata">

**Author:** ![bstt](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@bstt](https://forums.unrealengine.com/u/bstt)\
**Post date:** [February 14, 2019, 12:48am UTC](https://forums.unrealengine.com/t/rotate-mesh-through-material-using-world-position-offset/435912/6 "2019-02-14T00:48:21Z")

</div>

Hello again, I tried with Rotate about axis function but I came to nothing. An alternative is to use **[rotation matrix][1]**.

_(By the way my previous answer was completely wrong, if you want to rotate around only one axis, use Object position as pivot point and Absolute world position excluding offset as position (or an equivalent like (0,0,0) as pivot point and Local position excluding offset as position). But I found no way to combine 2 rotate about axis.)_

**RotateX :** float3(t.x, t.y \* cos(theta) + t.z \* sin(theta), - t.y \* sin(theta) + t.z \* cos(theta))

**RotateY :** float3(t.x \* cos(theta) - t.z \* sin(theta), t.y, t.x \* sin(theta) + t.z \* cos(theta))

**RotateZ :** float3(t.x \* cos(theta) - t.y \* sin(theta), t.x \* sin(theta) + t.y \* cos(theta), t.z)

 ![268544-capture-decran-60.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/a/3/1a3ea0531aac57097d87e0f703eabd583bdb2ad0.png)

---

<div class="post-metadata">

**Author:** ![ryguydavis](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ryguydavis](https://forums.unrealengine.com/u/ryguydavis)\
**Post date:** [October 6, 2021, 5:56pm UTC](https://forums.unrealengine.com/t/rotate-mesh-through-material-using-world-position-offset/435912/7 "2021-10-06T17:56:20Z")

</div>

This info was _so_ helpful. I’m struggling with rotating the normals, now. I see there is a FixRotateAboutAxisNormals node, but that really only pairs with RotateAboutAxis. I’ve read elsewhere that you multiply the normals by the rotation matrix but I can’t seem to get that working.

Any thoughts on getting this working?

---

<div class="post-metadata">

**Author:** ![Pendali](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pendali/32/765848_2.png) [@Pendali](https://forums.unrealengine.com/u/Pendali)\
**Post date:** [December 20, 2023, 8:32am UTC](https://forums.unrealengine.com/t/rotate-mesh-through-material-using-world-position-offset/435912/8 "2023-12-20T08:32:14Z")

</div>

Here is how you correct the normals with “RotateAboutAxis” for 1 direction:

> **[MF\_WPO\_Rotation posted by Pendali | blueprintUE | PasteBin For Unreal Engine](https://blueprintue.com/blueprint/_ghf2qk7/)**
>
> No description provided

And here is how you add multiple Rotations together:

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/5/f/35f616fde0498205fba761284c0db13571659b3d.jpeg "Unreal Engine 4 Tutorial: World Position Offset (WPO) - Rotating, Scaling, Translating Combined") ](https://www.youtube.com/watch?v=xM8JIwRqv5Y&t=296)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/f/9/bf95093f865a507daf8ce836765d1c896c450255.png)

As a bonus this is how you correct for non uniform scaleing:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/d/5/1d5f27ea53da16227a65fed7a4de110b8099945f.png)

---

<div class="post-metadata">

**Author:** ![Pendali](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pendali/32/765848_2.png) [@Pendali](https://forums.unrealengine.com/u/Pendali)\
**Post date:** [December 20, 2023, 10:39am UTC](https://forums.unrealengine.com/t/rotate-mesh-through-material-using-world-position-offset/435912/9 "2023-12-20T10:39:45Z")

</div>

Is there a way to add the objects “orientation” in the scene. So that the objects rotate individually in “Local space” istead of all of them rotating in worldspace?

---

<div class="post-metadata">

**Author:** ![TorQueMoD](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/torquemod/32/710746_2.png) [@TorQueMoD](https://forums.unrealengine.com/u/TorQueMoD)\
**Post date:** [July 4, 2024, 1:02am UTC](https://forums.unrealengine.com/t/rotate-mesh-through-material-using-world-position-offset/435912/10 "2024-07-04T01:02:34Z")

</div>

Just wanted to post the easier solution. The reason Rotate about Axis wasn’t working for you is because you need to multiply the angle by time. Otherwise it won’t move.

Using the RotateAboutAxis node (Cheap is broken because it inverts the mesh normals if you use Y) you specify the rotation axes with a vector 3 with R = X G=Y B=Z and you can use multiple axes at once (example 1,1,0 will give you yellow and rotate around X and Y at the same time).  
Normalize the RGB before plugging it into NormalizedRotationAxis.  
Rotation Angle should be Time\*Speed  
Pivot Point should be the ObjectPivotPoint node  
Position should use World Position XYZ

 ![RotateMeshWithWPO](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/4/2/1421884d5ec7546bf212a6b79c9b5412fdc0761f.png)
