예제 #1
0
    void updatejoint(int trackingId, int jointIndex, Vector3 pos)
    {
        if (!_Bodies.ContainsKey(trackingId))
        {
            addBody(trackingId);
        }

        K2MBody b = _Bodies[trackingId];

        b.updateJoint(jointIndex, pos);
    }
예제 #2
0
파일: K2M.cs 프로젝트: jlsfernandez/K2M
    void sendBodyData(K2MBody body)
    {
        OSCMessage m;

        m = new OSCMessage("/k2m/body/update");
        m.Append <int>(body.trackingId);
        m.Append <int>(body.leftHandState);
        m.Append <int>(body.rightHandState);
        m.Append <int>(sendExtendedSkeleton?1:0);
        client.SendTo(m, targetHost, targetPort);

        for (int i = 0; i < body.numJoints; i++)
        {
            if (!sendExtendedSkeleton)
            {
                bool isExtended = false;
                for (int e = 0; e < extendedSkeletonIndices.Length; e++)
                {
                    if (extendedSkeletonIndices[e] == i)
                    {
                        isExtended = true;
                    }
                }
                if (!isExtended)
                {
                    continue;
                }
            }

            Transform jt = body.joints[i];

            m = new OSCMessage("/k2m/joint");
            m.Append <int>(body.trackingId);
            m.Append <int>(i);
            m.Append <float>(jt.position.x);
            m.Append <float>(jt.position.y);
            m.Append <float>(jt.position.z);
            client.SendTo(m, targetHost, targetPort);
        }
    }