I’m trying to develop a procedural aim-down-sights system that will use IK to move the player’s hand to a location such that the sight of any weapon (determined by a “Sight” socket on each weapon) is aligned with the player’s camera.
To do this, I tried to get the camera’s transform and modify it by a small offset so the desired location is a little bit behind the sight, not right inside of it. Then, I tried to get the difference between the “Sight” socket and the bone that the weapon itself is attached to, i.e. the ik_hand_gun bone, which is the bone that will be moved to move the weapon.
I’m hoping someone can help me figure out what’s going wrong here? Here’s some screenshots of the relevant scripting:
If it’s not obvious, I’m still learning the animation system and am not super proficient with it. Thanks in advance for any help!