Cory

View Original

Rotating Object by Shader

Maybe by this point you’ve already done some of these things. Rotating an object. Simple right?

Every frame slightly rotating the object by a rate (value). It works, but Unreal already does so much for you. I’m sure there’s a component that does the same thing? There is, the Rotating Movement component. BUT it could be better, as this component is almost doing the same thing as above with a little more control.

What if we could do this in a shader? run the logic on the GPU which, for cheaper math operations like rotation would be negligible for performance. Luckily, that is also included in Unreal by default.

Here we get the objects orientation and Absolute World Position and rotate the vertices and normal’s of the mesh around its pivot point by a variable speed.