Game Development Reference
InDepth Information
By squaring both sides of the equations and adding them together, the
equation can be carefully rearranged to give
2
)=
Target.
x
2
+ Target.
y
2
 Length1
2
 Length2
2
2
*
Length1
*
Length2
cos(
Therefore,
Target.
x
2
+ Target.
y
2
 Length1
2
 Length2
2
2
*
Length1
*
Length2
2
= acos
So, all we have to do now is find
1
. Looking at Figure 9.4, we can use two
additional angles to help to find
1
.
Figure 9.4 How to find
1
.
1
=
3

4
Finding
3
is the same problem as the single link solution given above
3
= atan(
y
distance/
x
distance)
Looking at the triangle formed from the pivot of object 2, the target and the
right angle indicated, we can express the lengths of the two sides as
Length2
*
cos(
2
) and Length2
*
sin(
2
)
Search Nedrilad ::
Custom Search