示例#1
0
        public void Connect(string clientIp, string serverIp, string connectionType)
        {
            _isConnected = true;

            _rigidBodies = new List <RigidBody>()
            {
                new RigidBody()
                {
                    Name = "kinect", ID = 1
                },
                new RigidBody()
                {
                    Name = "leapmotion", ID = 2
                }
            };
            // call event handler that descriptions have changed
            OnDataDescriptionsChanged?.Invoke();

            var leapMotionRotation = Quaternion.CreateFromAxisAngle(Vector3.UnitX, 30f.ToRadians());

            // call frame available event handler
            OnFrameReady?.Invoke(new FrameOfMocapData()
            {
                MarkerSets = new[]
                {
                    // kinect
                    Mock.MockMarkerSetData("kinect", new[]
                    {
                        Vector3.Zero, new Vector3(3, 0, 3), new Vector3(0, 0, 3)
                    }),
                    // leap motion
                    Mock.MockMarkerSetData("leapmotion", new[]
                    {
                        Vector3.Zero, new Vector3(6, 6, 3), new Vector3(6, 0, 3)
                    })
                },
                nMarkerSets = 2,
                RigidBodies = new[]
                {
                    new RigidBodyData()
                    {
                        ID = 1, x = 1, y = 0, z = 2, qx = 0, qy = 0, qz = 0, qw = 1
                    },
                    new RigidBodyData()
                    {
                        ID = 2,
                        x  = 4,
                        y  = 2,
                        z  = 2,
                        qx = leapMotionRotation.X,
                        qy = leapMotionRotation.Y,
                        qz = leapMotionRotation.Z,
                        qw = leapMotionRotation.W
                    }
                },
                nRigidBodies = 2
            });
        }
 private void FireDataDescriptionChanged()
 {
     OnDataDescriptionsChanged?.Invoke();
 }