Rotate mesh through material using World Position Offset

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?


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.

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

Supply rotation matrix and transform world position using it.

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

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)

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?