Hi,
I know this question was made before but the solutions I found did not work as espected.
I parented a gun object to the character´s hand bone using this code:
gun.transform.parent = rightHand;
gun.transform.localPosition = Vector3.zero;
gun.transform.localRotation = Quaternion.Identity;
I tried this with an empty acting as a child of right hand bone or a direct
parenting to right hand bone.
After that, the gun started to follow the character but not in the right position and rotation but some units away from hand (floating in the air).
I don´t know what is wrong with the code or what I am missing.
As you can see in the picture, the gun is away from right hand but if character is moving, the gun follows the right hand.