I’ve been trying for days, but can’t understand what statements to use to get the rotation I want.
A rotation (around the x and y axes) in world space by deltaQuat does exactly what I want.
deltaQuat = FQuat::Identity; deltaQuat = deltaQuat * rotateCM(DeltaTime); deltaQuat = deltaQuat * barrelRollRotate(DeltaTime); LocalToWorld = OurVisibleComponent->GetComponentQuat(); LocalToWorld = (deltaQuat * LocalToWorld); //will change rotation in **world space** by deltaQuat. OurVisibleComponent->Set**World**Rotation(LocalToWorld);
But this doesn’t produce the result I want when I also have a world rotation around the z axis. I want it to rotate around itself, and not around the fixed axes of the world. So I should use relative rotation, right?
I thought this would do the trick:
LocalToWorld = OurVisibleComponent->GetComponentQuat(); LocalToWorld = LocalToWorld * deltaQuat; //will change rotation in **local space** by deltaQuat. OurVisibleComponent->Set**Relative**Rotation(LocalToWorld);
But whenever I use SetRelativeRotation(…) my pawn just keeps spinning. Now I suspect it is because GetComponentQuat() returns the rotation in world space, not in relative space. But there doesn’t seem to a relative space equivalent of GetComponentQuat.
So I’m stuck, and out of options