示例#1
0
    /// <summary>
    /// set rotation of back arm and position relative to arrow
    /// </summary>
    /// <param name="degree">angle which back arm rotation will be set</param>
    public void setBackArm(float degree)
    {
        Vector3 centerTarget = endArrow.position;
        Vector3 centerArm    = arm_back.position;

        Vector2 out1, out2;

        int a = MathFuncs.FindCircleCircleIntersections(
            endArrow.position.x, endArrow.position.y, _lengthForeArm,
            arm_back.position.x, arm_back.position.y, _lengthBackArm,
            out out1, out out2
            );

        if (float.IsNaN(out1.x))
        {
            Debug.LogError(a);
            return;
        }

        arm_back.LookAt2D(out1);
        forearm_back.position = endArrow.position;
        forearm_back.LookAt2D(out1);
        cross_arm_back.position = out1;
    }