Quaternion based rotation of Controller component

Hi all,

My goal is to allow the rotation of my Actor, Camera and Controller to any surface using an impact normal for calculations. I want to make a game where the character is free to traverse any surface, as long as a trigger box allows it. In other words, I have no need for defensive navigation components that the character movement component class implements in its default walking mode. I have overridden the flying mode of the character movement component, as I couldn’t dig down deep enough to disable the traversable slope angle restrictions. So far, it’s working well. I have my character rotating to match any surface without problem using quaternion calculations, as well as the proper movement directions based on the character’s rotation about a surface.

However, I would like to preserve the concept of the controller/camera yaw. I am a beginner in these concepts, but I realize there is no default concept of yaw in quaternion representation. It seems like the controller component does not have an overloaded method for SetControlRotation() that accepts a quaternion for rotation. If I override the controller class like I did the character movement component, how can I achieve this? If I understand how quaternion rotations are done, I would fundamentally be looking at a rotation of X degrees around the actor’s “up” vector to get a similar effect to yaw rotation.

Would this work? If not, any assistance with the math concepts would be appreciated.

You can get a rotator from a quaternion.

FRotator Rot = Quat.Rotator();

Hi neo, thanks for the reply.

I want to avoid Gimbal lock. I know that you can convert between FQuat and FRotator very easily, but I want unrestricted rotation for my character. If I’m not mistaken, converting it back to a FRotator leaves the potential for Gimbal lock.