I am trying to get ForwardVector for the component, but the result is incorrect if the angle of rotation of the entire object is Y = 0.0.
I tried different options, but none worked.
FVector XForward = GizmoActor->ArrowCompX->GetForwardVector();
FVector XForward = GizmoActor->ArrowCompX->GetComponentRotation().Vector();
FRotator XForward2 = GizmoActor->ArrowCompX->GetComponentRotation();
XForward = FRotationMatrix(XForward2).GetScaledAxis(EAxis::X);FVector XForward = GizmoActor->ArrowCompX->GetComponentQuat().Vector();
FVector XForward = FRotationMatrix(GizmoActor->ArrowCompX->GetComponentRotation()).GetScaledAxis(EAxis::X);
If the Y-axis rotation is 0, then ForwardVector is always X=0.000 Y=-0.000 Z=-1.000.
How to solve the problems?
UPD: This problem may exist if:
Import a mesh that is not aligned along the X-axis (in blender, my object was turned up)
Create a BP and add a Scene Component
Add an object to the mesh and rotate it by 90 or -90 degrees.
Get an incorrect ForwardVector.
Perhaps this problem exists if:
In c++, you can also change the order of components.
At least with the new Blueprint there is no such problem.