Split Relative Rotation into two components

I have a spotlight that I want to rotate towards a direction, using only one axis of rotation for each of the two moving components. The base doesn’t move at all.

Here’s a screenshot of the swivel portion. It should only rotate along the axis shown. (Just happens to be roll)

Here’s the head portion. It should only rotate along the axis shown (pitch in this case)

I can make the head rotate correctly just fine using just SetWorldRotation, but this is not ideal since it isn’t constraining the head to only the pitch, and its not rotating the swivel at all obviously.

Another issue is that I can’t figure out how to rotate it using relative rotation. It works until I rotate the base actor from its default rotation.

Any help is much appreciated
Mark

Components have the Set Relative Rotation node, you can also split the input rotation pin as well, like this:

If you have more than 1 component for each of the parts of your object, you can set different types of rotation to each of the components.

Remember that pure nodes are executed each time a value is asked of them, so I would suggest storing the rotation in a variable so you can use it to set the rotation to the next component as well (pitch, roll)

I hope that’s what you were trying to do

Also beware of gimbal locks, although I don’t expect you to run into that

You can right click on the rotator variable and break it into 3 floats for each rotation axis.
As for why it doesn’t work with relative rotation - it doesn’t because you change the forward vector of the component if it’s attached to something else which rotates. So the rotation doesn’t match anymore. You can add the rotation of whatever this is attached to the formula and it should work.

1 Like

Even with the actor rotation set to default, something is still off to where the head doesn’t point in the same direction as the line trace.

Btw i’m using the yaw from the look at rotation since roll will be zero

in the second set relative rotation node you’re setting yaw to roll instead of yaw to yaw (if that makes any sense), I used roll as you used roll in your OP

I know, but the roll from FindLookAtRotation will be zero, so the only other option is to use the yaw