Set local rotation

Unfortunately it seems there is no “SetLocalRotation” node, and the only way to rotate an object on it’s local axis is to use the “AddLocalRotation” node.

I want an object to match the Z value rotation of another object, but to rotate on it’s local axis instead. Niether SetRelativeRotation or SetWorldRotation seem to work this way. Does anyone know of a way to set a local rotation instead of just adding to it?

local space rotations are for components that are attached to other components. if you want to rotate an actor around its up vector, you can use RotatorFromAxisAndAngle. and if you want to set the rotation, instead of adding to it, just skip the getActorRotation/CombineRotators part.

2 Likes

Thanks for your response!
I should have included that the object I want to set rotation on is a component attached to another component.

I attempted it on the component using SetRelativeRotation in place of SetActorRotation and GetUpVector instead of GetActorUpVector. It does follow the rotation of whatever I feed it, but it still doesn’t want to rotate on it’s local axis.

up vector is always a world vector, its not relative, so you should use SetWorldRotation instead of SetRelativeRotation.

and if you just want to set the rotation, instead of adding to it, replace the GetWorldRotation node with a Rotator variable, where you can store the default rotation.

That worked!! Thank you so much! You saved me a lot of trial and error. :slight_smile: