• News

• Industries

• Learning & Support

• Community

• Marketplace

# Lock rotator to vector axis

How would I be able to only rotate around an axis of my designation? I want to on tick set my character rotation to face a given direction but the axis to rotate would change depending on their orientation. The idea would be to rotate around {get actor rotation-get up vector} instead of roll, pitch, or yaw. Is there a way to do this?

If you right click the rot node output you can “extend” it, transforming it into floats, then you just connect the angle you need. Also I recommend to not do this on tick, rather make a function you call when a bool is true (which you can place on Tick).

I know you can break the float into roll, pitch, and yaw but this is not what I meant. In a normal third person game the player’s up axis would always be yaw, but for my game the player rotates and changes gravity to constantly be downward of the player. This allows them to stand on the walls and ceiling (meaning yaw wouldn’t always work). I want to be able to get the up axis of my player and rotate around that instead of using roll, pitch, or yaw.

Rotate around axis node. I’ve had good results with that anyway.

The only node I’ve found like that is the Rotate Vector Around Axis node, but I’m not sure how I would be able to use it to rotate an actor/component. Is there a node that returns a rotator when given an axis and angle?

Edit: I found the Rotator from Axis and Angle node and is does what I was looking for.

Now that I’ve found a way to make rotation from an axis and angle I need to know if there is a way to get an angle from an axis and rotator. The idea would be you enter a rotator and axis and it would give you the angle of rotation for that axis. For example, if you have a rotator at 45 roll, 45 pitch, and 50 yaw and an axis of 0,0,1 it would return a float of 50 degrees for the given axis (z).