Having a turret base rotate yaw but maintain the parents relative pitch and roll

Hello. I am creating turrets that are child actor components of a large ship, and I rotate the yaw of the body of the turrets to face the target (the barrels then do pitch).

The problem is, if the parent ship rolls or pitches, the turret will not follow because I am setting it’s world rotation.

I can not set the pitch and roll world rotation to that of the parents at the same time as I do the yaw, because the yaw changes what the pitch is (IE it’ll be rotated differently than the parent so pitch rotates it in different direction than the pitch of the larger ship)

I’ve tried many ways around this but can’t seem to solve the issue. I feel like I should be able to do something with set relative rotation instead or get the parents rotation and compare it somehow but I can’t figure out the math (not my strong suit)

Any suggestions?

Here is my BP:

I’m bad at maths as well.

But we had a similar problem way back and our technical animator included a node called “BaseRotation” or something of that sort in the calculation to solve the problem.

Sorry, it was just my two cents.