There are probably a few ways you can do this, but you can simplify this quite a bit. I also suspect you can do all of it in the animation blueprint.
- Simplify the first part (XDoMa.jpg) using the
Find Look At Rotation
node.
- Break the output of this and create another rotator with the yaw from that node and the pitch and roll from the turret's world rotation (you're currently setting pitch and roll to zero in cDJ08.jpg, which you don't want to do in case the tank is on a slope).
- To rotate the turret to point at the target, use the
RInterp To
node and connect its output rotator to a Set World Rotation
node. The nice thing about the 'RInterp To' node is that you can set the speed. For a bit more realism you could use some simple maths to accelerate and decelerate the turret's rotation.
- Another thing you'll want is a bool variable in the tank actor BP. Then you can use a branch in the animation BP to trigger the stuff above when you set the bool to true.
The key parts to this are the Find Look At Rotation
and RInterp To
nodes, and to do all of it in the animation BP.