- Home /
Question by
nicmarxp · Jun 28, 2019 at 10:07 PM ·
2daiminginverse kinematic
How to aim gun using 2D IK with a fixed elbow rotation?
I'm doing an "aim-gun-towards mouse" with a 2D skeletal character with 2 bones, ArmUpper and ArmLower (hand is fixed) and I think I need some kind of IK solver. Here are the parameters:
ArmUpper: Fixed position in the shoulder, but can rotate freely
ArmLower: Has a fixed rotation (depending on weapon type), and it's position is set by rotating ArmUpper, which makes it end up somewhere in the green circle
The question: How can I calculate the rotation of ArmUpper so that both ends of ArmLower aims towards the target reticle?
I'm making this with Unity in C#, but any pseudo-code or formula will help.
Thanks!
Comment