Hi, there is something I am obviously missing regarding quaternion rotation, and the below example running on character tick demonstrates it. I am expecting this code to pitch the character by 20 degrees upwards then rotate the character around the new character up vector. But this is not what is happening, while rotating, the character up vector is constantly changing direction. Thanks to let me know what I am missing!
on character tick:
FTransform actorTransform = GetActorTransform();
FQuat targetRotation = actorTransform.GetRotation();
static bool doOnce = true;
if (doOnce)
{
// pitch up by 20 deg.
targetRotation *= FQuat(targetRotation.GetRightVector(), FMath::DegreesToRadians(-20.f));
doOnce = false;
}
// yaw rotation around the up vector
targetRotation *= FQuat(targetRotation.GetUpVector(), FMath::DegreesToRadians(10.f * DeltaTime));
actorTransform.SetRotation(targetRotation);
SetActorTransform(actorTransform);