Example #1
0
    static ZgInputJoint ToZgInputJoint(ZigInputJoint aJoint)
    {
        //return new ZgInputJoint (sJointTypeMap[aJoint.Id], aJoint.Position, aJoint.Rotation, aJoint.Inferred);
        //I'm pretty sure this conversion from ZigJointId to ZgJointId is fine
        var r = new ZgInputJoint((ZgJointId)((int)aJoint.Id), aJoint.Position, aJoint.Rotation, aJoint.Inferred);

        r.GoodPosition = aJoint.GoodPosition;
        r.GoodRotation = aJoint.GoodRotation;
        return(r);
    }
    public float get_waist(ZgInputJoint waist, ZgInputJoint L, ZgInputJoint R)
    {
        float r = 0;

        //TODO some problems with this lockngi... Should default to below if that happens
        //if(!mManager.mZigManager.using_nite())
        //r = -waist.Rotation.flat_rotation() + 90;
        //else
        r = get_relative(waist.Position, L.Position * 0.5f + R.Position * 0.5f);

        return(r);
    }
Example #3
0
    Quaternion get_relative_rotation(ZgInputJoint A, ZgInputJoint B, Vector3 aRelative)
    {
        Vector3 v = B.Position - A.Position;

        return(Quaternion.FromToRotation(aRelative, v));
    }
    public float get_relative(ZgInputJoint A, ZgInputJoint B)
    {
        float r = 0;

        if (A.Id == ZgJointId.None)
        {
            return(0);
        }
        if (!B.GoodPosition)
        {
            if (B.Id == ZgJointId.LeftElbow ||
                B.Id == ZgJointId.RightElbow)
            //|| B.Id == ZigJointId.LeftHand
            //|| B.Id == ZigJointId.RightHand)
            {
                r = mImportant[A.Id].smoothing.current;
            }
            else
            {
                r = -A.Rotation.flat_rotation() + 90;
            }
        }
        else
        {
            r = get_relative(A.Position, B.Position);
        }


        //openni fix to solve head being set to -90 angle problem
        if (B.Id == ZgJointId.Head)
        {
            if (!B.GoodPosition)
            {
                r = -90;
            }
        }



        if (B.Id == ZgJointId.LeftHand)
        {
            if (!B.GoodPosition)
            {
                r = mImportant[ZgJointId.LeftShoulder].smoothing.current;
            }
        }

        if (B.Id == ZgJointId.RightHand)
        {
            if (!B.GoodPosition)
            {
                r = mImportant[ZgJointId.RightShoulder].smoothing.current;
            }
        }

        //double the waist angle on XB1 only because waist is not as sensitive on kinect2.0
        if (B.Id == ZgJointId.Neck && GameConstants.XB1)
        {
            r = -90 + (r + 90) * 2;
        }

        return(r);
    }
Example #5
0
 Quaternion get_relative_rotation(ZgInputJoint A, ZgInputJoint B)
 {
     return(get_relative_rotation(A, B, new Vector3(1, 0, 0)));
 }