Need help calculating a transform (knowing child world rotation and child relative rotation, calculate parent world rotation)

I want to rotate my actor at desired location.

First, I get a world look rotation to the aiming coordinate.

Then I could SetActorRotation to that transform. Unfortunately, instead of actor pointing with X axis to that coordinate, I need it to point there with Y axis as for legacy code reasons I have to keep the weapon mesh in that direction.

image

So I need to somehow get a new rotation for the whole actor to use it in SetActorRotation.

I tried ConvertTransformToRelative, but couldn’t get it working

After I formulated “(knowing child world rotation and child relative rotation, calculate parent world rotation)”, it became much eaiser to find the function I needed.