make a rigged character gun point to a target without ik


I’m trying to make a tactical turn based game, like Silent Storm and Jagged Aliance2. The thing is going forward nicely. But, i’m constructing the accuracy and shooting system as follows: I’ve the Mixamo Swat soldier rigged and animated. Because i dont know how to animate characters or anything about ik, i make the soldier point to a target disabling de Animator component, and rotating the spine by code. Prehistoric way , but a logic one. The problem is that i select the target pointing it with the mouse cursor. When the target is selected, the current soldier will turn on th Y axis to point to the target. Okay! the soldier is pointing to the target, but the gun is in the top right corner of the soldier, so it never point to the target with any precission. I tried rotating the spine and at long distances it is close to accurate. But obviously this is not the way! I need to rotate the player, and then the spine to SOME Quaternion that makes the gun point to the target.

I dont know if this is barely explicatory

Sorry for my English And Thanks

well if you bind the player hand to the gun you can just aim the gun via
gun.transform.rotation = quanternion.lookat(target)

of course the other possibility is to look not at the enemy but assuming the gun is in right hand the aimpoint should be I THINK

aimpoint = enemyposition + (player.transform.left * vector3.distance(player.transform.position, gun.transform.position));

this should shift the aimpoint left enough to account for the gun and aim the gun not the player. I could be wrong but that should work based on my mental picture of the trig involved.

Ok, the problem now is that the spine and the shoulders and arms that hold the weapon have
diferent rotations, so i have to consider also this to calculate how much the spine have to rotate in base of distance to the target and the offset position and rotation of the gun.

I really dont know how to calculate that!

Any idea?