FQuat instead of FRotator? (code doesn't work)

I’m trying to rotate an object using AddActorWorldRotation, which in blueprints works fine. But when i use it in code it takes a FQuat instead of the old FRotator now for
some reason which is fine but my code bugs-out and i have no idea why?

Bug:
In my code, instead of rotating the actor 5 degrees like i set it to, it rotates 180 degrees if the value is higher than 1 but if lower it doesn’t rotate at all.

here is blueprint:

Here is code:

Yeah Quat’s don’t work that way, they’re Axis-Based so essentially what you’ve entered isn’t a valid quaternion I think.

What you can just do instead is pass in an FRotator still, but add .ToQuat() on the end, which will convert a rotator to a quaternion. Thusly:



Actor->AddActorWorldRotation(FRotator(0.f, 5.f, 0.f).ToQuat());


I got an error with .ToQuat() so i used .Quaternion() instead and it worked, Thanks!

Sorry yeah that’s the one!