Yes, that’s the question, How to convert local Rotation to World Rotation?
Hello ja0335,
The simplest way would be to take the component’s current local rotation and then add it to the parent’s world rotation, since it’s going to be relative to its parent. When it comes to rotation, you’ll need to convert these values to radians first however, otherwise you could end up with values outside of the Yaw/Pitch/Roll limits. You can convert them back after you’ve done the calculations.
Lets say i know the global rotation of the scene component
FTransform ComponentWorldTransform;
// Now i have a yaw rotation of 90 degrees
FRotator Rotator(0,90,0);
// Here what operation must be performed to convert the Rotator to WorldSpace?
You would need to use the FMath::DegreesToRadians function to convert the degrees from degrees to radians, add the 3 axis values of the World rotation of the parents and the Local rotation of the Rotator, use FMath::RadiansToDegrees to change it back, and then there is your World rotation.
This is assuming that your “scene component” is the parent while “ComponentWorldTransform” is a child of it. If that’s not the case, please explain your hierarchy.
can you example it in code if it’s possible?
You can use TransformRotation function to convert local to world rotation, and InverseTransformRotation for vice-versa (world to local).