Turret with Relative Rotation Aiming

I’ve been trying to create multi part turrets for my game entirely within blueprint and I am having an issue with relative rotation. I’m hoping it’s just my brain shorting out and not anything too difficult.

I can’t simply set the world rotation of the turret parts because I want them to be mounted anywhere at any angle, and most of all on moving ships. The turrets are made up of 3 static meshes. A stationary base, a tower that turns left and right, and guns that pitch up and down.

I have searched online and found some explanations for c# and c++, but I am trying to work exclusively within blueprint and can’t seem to figure out how to translate the quaternion math.
As it stands, my turrets work as long as there is no rotation on the Z axis. I can have them on the floor, ceiling, or rotated along the Y axis to put them on a wall, but my main question is how can I use the Z rotation to influence the X and Y to correct the turrets look direction. I can get 2 rotational axis to work together, but not all 3. Is there an equation or workaround for this and have it still update in real time while on a moving platform, or is there another way to go about doing this entirely?

Here’s the blueprint for my turret’s aim function that I am activating within the tick event for now

This video shows my turrets current behavior. The ones on the left work perfectly without any rotation on the Z axis, the one on the right has Z rotation applied.

I’m not sure I understand the question, if the turrets on the left work fine, what is wrong with them? Why don’t you just use what you are doing for the turrets on the left? Is it just that this is not working properly on moving platforms? What is the result?

Edit: From what I see, this should work fine on a dynamic platform unless there is some sort of hard-coded number I am missing. Perhaps I misread your question.

This might help


Hey there,

maybe my code from this topic can help you. It should contain all you need.


Hey thanks everyone for the quick replies! Abarudra, that worked perfectly! I was missing that Inverse Transform Direction node.

Glad i can give something back to this awesome community.

Maybe that can help i found a tutorial on www.vaduunlabs.com :


With the help of this tutorial, you will be able to animate turrets in UE4, which are always tracking the target correctly, regardless of their own orientation.