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.