I have no idea what this is called but its an angle..

ScriptOn

New member
Joined
Aug 24, 2014
Messages
3
Capture.jpg

Alright so I have no idea how to explain this but pretty much I`m a game developer and I've come across a problem, I have to point the arms at the mouse, I know exactly what to code just not the math behind it, so this is my problem:

The arm has two joints (points) called Shoulder and Elbow, with each joint comes a part of your arm (So attached to shoulder is Half of your arm, your elbow, then the other half of your arm, but we also have the elbow which is attached to in the center). Pretty much this is a real arm, you have a shoulder and an elbow joint. The problem is I need to have the fist of the arm always in the same position on the screen, to do this I need to make the two joints always at a certain perfect angle so that they reach point B.

So to summarize (sorry if this is confusing):

Point A: Shoulder
Point B: The target point, this can vary so I need a formula
Joint: The connecting joint between Point A and Point B, it also connects the two halves of the arm

A few things to note: The arm size can never change, but Point B will always be in reach (I set point B manually somewhere else, don't worry about point B).

So here is what I need to figure out: How do I figure out the formula for Point A and Joint's angle so that the tip of the arm hanging off of Joint always touches point B? Like this:

Capture.jpg

Edit: I forgot to mention I can ALWAYS get the magnitude from Point A and point B
 
So "point A" is fixed and "point B" is fixed and you want to know the different possible positions for C and the angle at C? One point to notice is that since the "length of the upper arm" (A to C) is also fixed, r1 say, C must lie on a circle about A with radius r1. Since the "length of the lower arm" (C to B) is also fixed, r2 say, C must lie on a circle about B with radius r2. That is, C must lie on the intersection of those two circles- and two circle intersect in at most two points.

Further, since the "length of the upper arm" (A to C), the "length of the lower arm", and the "distance from shoulder to hand" are fixed, you have the entire triangle given by the "SSS" congruence relation. The two possible positions of C are on that triangle flipped around line AB.
You can find angle C using the "cosine law": (AB)2= (AC)2+ (BC)2- 2(AC)(BC) cos(C).
 
So "point A" is fixed and "point B" is fixed and you want to know the different possible positions for C and the angle at C? One point to notice is that since the "length of the upper arm" (A to C) is also fixed, r1 say, C must lie on a circle about A with radius r1. Since the "length of the lower arm" (C to B) is also fixed, r2 say, C must lie on a circle about B with radius r2. That is, C must lie on the intersection of those two circles- and two circle intersect in at most two points.

Further, since the "length of the upper arm" (A to C), the "length of the lower arm", and the "distance from shoulder to hand" are fixed, you have the entire triangle given by the "SSS" congruence relation. The two possible positions of C are on that triangle flipped around line AB.
You can find angle C using the "cosine law": (AB)2= (AC)2+ (BC)2- 2(AC)(BC) cos(C).


I`m not quite sure if this changes the required math but pretty much point A never moves, point B constantly moves (but within reach of 180* at angle C).
 
Top