Change Mesh Rotation with WPO

Hey there,

I try to change an actors rotation by using World Position Offset in the Material editor and a vector input from blueprint. A replacement for usual movement so to speak. Simply like: Left Arrow = Rotation Z Axis, Up Arrow = Rotation X/Y Axis.

This is what I got so far:

The basic setup in the Material Editor should be alright. Sadly I can’t figure out, what I need to feed the “Rotation Change Vector” with (in blueprint). Just taking the meshes rotation doesn’t work (wrong axis).

Does somebody know? Thanks.

Hi Pixel-ate Bytes,

That’s just a Normal vector to describe the axis to rotate - as you’re wanting to rotate around the z axis, a normal of “0,0,1” should work.

It’s a Material Parameter getting fed by a blueprint. The blueprint checks if the mesh of that blueprint is rotating up/down/left/right. That information needs to get into the Parameter and used to determine the correct WPO, so it LOOKS as if the mesh is actually rotating in this direction (while it’s not really doing so).

Yes that’s ok - just convert from a Vector4 to a Vector3 - the blueprint can decide which axis to use and set the parameter to that (i.e 0,0,1) - if you’re rotating on multiple axis - do one axis at a time.

You are talking about “Get Rotation” in the blueprint? Because I tried that in many ways and never got it to work. It rotates in all sorts of weird directions.

The RotationChange_Speed scalar should actually just be the rotation - the blueprint should calculate the angle from the speed - or the material can do it by using the Time node - but it should be something like:

So then I need 3 of those - one for each axis - and then intertwine them in some way? And how do I get the correct information from the blueprint? Just by “Get Rotation” of the mesh and then taking X, Y, Z separately?

Yes that’s correct, something like:

1 Like

Oh Jesus I thought it’d be easier :smiley: Thanks a lot for the effort. Gonna try it tomorrow and mark it as solved then (probably).

1 Like

Yeah - not exactly simple I’m afraid. Here it is so you can copy/paste it:

https://dev.epicgames.com/community/snippets/lPyw/unreal-engine-rotateaboutaxis-in-all-axis

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.