I had wondered about UnrotateVector, but I must be using it wrong because it’s not working for what I’m trying to do.
For example:
FVector Forward = Arrow->GetForwardVector();
FRotator Rotation = UKismetMathLibrary::MakeRotFromX(Forward);
FVector UnrotatedVector = Rotation.UnrotateVector(Forward);
This just gives a return FVector of {1, 0, 0}. This seems like a redundant and incorrect usage of UnrotateVector though, because no matter what forward vector you start with, it will always return that result. And that is also the same forward vector as the thing I need to rotate anyway. I need to rotate the scene component such that its child arrow component now points along {1,0,0}.
But when I try to unrotate the starting vector of {1,0,0} using the rotation of the arrow component like this:
FVector SceneComponentForward = SceneComponent->GetForwardVector(); // this is {1,0,0}
FVector Forward = Arrow->GetForwardVector();
FRotator Rotation = UKismetMathLibrary::MakeRotFromX(Forward);
FVector UnrotatedVector = Rotation.UnrotateVector(SceneComponentForward);
That doesn’t produce the intended result either. So either this function doesn’t do what I need it to do, or I’m misunderstanding and using it wrong (fairly likely to be honest).