I'm creating a procedural aiming animation system in UE5 as a learning experiment.
In order to position the hand for aiming down sights, I'm using a forward vector from player camera to project out a point centered in the camera POV. I then account for the offset between the rear weapon sight socket attached to the weapon, and the hand bone to create the IK target for the hand shown as a pink circle. I believe I've done that correctly.
The real challenge I'm facing is with rotation. I'm struggling to procedurally rotate the hand bone in such a way that aligns front sight, rear sight, and camera along the green line shown in the pictures. The green line starts from center camera and ends at the rear sight.
I believe there's a way to construct a quaternion from two vectors using the dot product to rotate the hand bone and align the sights? The different spaces (world, hand, and rear weapon sight) are also adding to my confusion. Any input is greatly appreciated.
