I have a Pawn which I am controlling using a PlayerController. The Pawn has a child weapon attached to it. The weapon has a socket attached to it that defines the direction that bullets fly. The weapon is offset both by position (Vector) and possibly rotation (Rotator/Quaternion) in 3 dimensions (X, Y, Z).
How do I calculate a Control Rotation for the Pawn, which by rotating the pawn, points the weapon’s forward vector at the target? (used with SetControlRotation, in the PlayerController).
Pointing the Pawn at the target is easy with a LookAt rotation. It is the weapon offset in 3D that gives me trouble. I would like the calculations before rotating the Pawn; I want to avoid any solution that first turns the Pawn and then turns it again to correct the offset. One turn only, please.
Thanks in advance for any help!
(P.S. I also posted this question on the Answers site https://answers.unrealengine.com/questions/1002532/view.html)