Example #1
0
    void Start_Now()
    {
        instance = this;
        Quaternion quatTiltAngle = new Quaternion();

        quatTiltAngle.eulerAngles = new Vector3(-SensorAngle, 0.0f, 0.0f);
        kinectToWorld.SetTRS(new Vector3(0.0f, SensorHeight, 0.0f), quatTiltAngle, Vector3.one);

        AsyncCallback callback = null;

        callback = ar =>
        {
            newIncomingEndPoint = remoteEPReceive;
            data = udpServerReceive.EndReceive(ar, ref newIncomingEndPoint);
            udpServerReceive.BeginReceive(callback, null);
            String json = Encoding.ASCII.GetString(data, 0, data.Length);

            if (json == String.Empty)
            {
                saveHuman = null;
            }
            else
            {
                saveHuman = JsonUtility.FromJson <humanBody>(json);
            }
        };
        udpServerReceive.BeginReceive(callback, null);
    }
Example #2
0
    // Update the avatar each frame.
    public void Update()
    {
        if (!transform.gameObject.activeInHierarchy)
        {
            return;
        }

        // Get the KinectManager instance
        if (c == null)
        {
            c = CooplayerCoords.Instance;
        }

        // move the avatar to its Kinect position
        MoveAvatar();

        for (var boneIndex = 0; boneIndex < bones.Length; boneIndex++)
        {
            if (!bones[boneIndex])
            {
                continue;
            }

            if (boneIndex2JointMap.ContainsKey(boneIndex))
            {
                clientRokoborba.SkeletonPositionIndex joint = boneIndex2JointMap[boneIndex];
                TransformBone(joint, boneIndex);
            }
        }

        //if(c != null && c.data != null && c.newIncomingEndPoint != null)
        //    udpClient.Send(c.data, c.data.Length, new IPEndPoint(IPAddress.Parse("192.168.1.5"), 12345));
    }
Example #3
0
    // Update the avatar each frame.
    public void Update()
    {
        if (!transform.gameObject.activeInHierarchy)
        {
            return;
        }

        // Get the KinectManager instance
        if (c == null)
        {
            c = CooplayerCoords.Instance;
        }

        // move the avatar to its Kinect position
        MoveAvatar();

        for (var boneIndex = 0; boneIndex < bones.Length; boneIndex++)
        {
            if (!bones[boneIndex])
            {
                continue;
            }

            if (boneIndex2JointMap.ContainsKey(boneIndex))
            {
                clientRokoborba.SkeletonPositionIndex joint = boneIndex2JointMap[boneIndex];
                TransformBone(joint, boneIndex);
            }
        }
    }
    void Start_Now()
    {
        instance = this;
        Quaternion quatTiltAngle = new Quaternion();

        quatTiltAngle.eulerAngles = new Vector3(-SensorAngle, 0.0f, 0.0f);
        kinectToWorld.SetTRS(new Vector3(0.0f, SensorHeight, 0.0f), quatTiltAngle, Vector3.one);

        AsyncCallback callback = null;

        callback = ar =>
        {
            newIncomingEndPoint = remoteEP;
            data = udpServer.EndReceive(ar, ref newIncomingEndPoint);
            //udpClient.Send(data, data.Length, new IPEndPoint(IPAddress.Parse("192.168.1.5"), 12345));
            udpServer.BeginReceive(callback, null);
            String json = Encoding.ASCII.GetString(data, 0, data.Length);

            if (json == String.Empty)
            {
                saveHuman = null;
            }
            else if (json == "a")
            {
                kill = true;
            }
            else if (json == "b")
            {
                bekilled = true;
            }
            else
            {
                saveHuman = JsonUtility.FromJson <humanBody>(json);
            }
        };
        udpServer.BeginReceive(callback, null);
    }