Download

SetActorRotation inputs different values in Rotation details.

Hello all,

I’ve been trying to figure out why when I use the Set Actor Rotation function from a widget, the value that is input to the actor is different from the one I pass on.
The result is the same but I worry about the interpolation.

For instance:
If I set the rotation in this simple Bluprint to be:
0,190,0
It sets the rotation field to:
180,-10,180

Or here if I input:
60, 210, 0
It returns:
-120,-30,180

It achieves the same rotation, but it is really peculiar how it gets to that, why not passing the value as I entered it? What am I missing?

This is the full BP, eventually I want to map the rotation from the slider, but first I want to get the same numbers back:

Thank you for any help!
Cheers

It’s to do with how UE stores rotations. At some point during manipulation, one ( or more ) axis will jump 180 degrees. Basically 180 is the same as -180.

If you don’t like this ( there are few who do ), only ever add or subtract from the rotation, don’t set it, and keep the current rotation in a variable. Don’t inspect the actor itself.

Hello ClockworkOcean,

thank you for your reply!
Could I please ask for a bit more clarification? Sorry but it is all quite new to me.

I tried what you suggest, but I still get it swapping after 180 instead of going up.
See my gif below, to see what I am doing:
add_rotation

I also have a few questions :

  1. What does it mean to “Inspect” and actor?
  2. How do I keep the current rotation in a variable?
  3. What are the scenarios where the axis jumping between 180 and -180 is useful, just as general knowledge, thanks.

Thanks again for the help!

Try using AddActorLocalRotation :slight_smile:

Add…Rotation nodes will always work, if they are ‘local’.

In general, never use any kind of Get…Rotation node, because that will be feeding you back garbage. Just make a rotator variable and set it to 0,0,0 ( or the actual starting rotation of your actor ) and only ever change that variable. Then you can use Set…Rotation nodes.