Exemple #1
0
        public bool Connect(string ipAddress)
        {
            int returnCode = m_natNetClient.Initialize(
                m_localAddr.ToString(), ipAddress);

            if (returnCode == 0)
            {
                if (Constants.DebugPrint)
                {
                    Debug.WriteLine("Initialization succeeded ...");
                }

                m_rigidBodies.Clear();

                List <DataDescriptor> descs = new List <DataDescriptor>();
                bool success = m_natNetClient.GetDataDescriptions(out descs);
                if (success)
                {
                    foreach (DataDescriptor d in descs)
                    {
                        if (d.type == (int)DataDescriptorType.eRigidbodyData)
                        {
                            RigidBody rigidBody = (RigidBody)d;
                            m_rigidBodies.Add(rigidBody);
                        }
                    }

                    IsConnected = true;
                    return(true);
                }
                else
                {
                    if (Constants.DebugPrint)
                    {
                        Debug.WriteLine("Could not get data descriptors ...");
                    }

                    m_natNetClient.Uninitialize();
                    return(false);
                }
            }
            else
            {
                if (Constants.DebugPrint)
                {
                    Debug.WriteLine("Error Initializing!");
                }

                IsConnected = false;
                return(false);
            }
        }
        private void FetchDataDescriptor()
        {
            /*  [NatNet] Fetch Data Descriptions. Instantiate objects for saving data descriptions and frame data    */
            var result = _natNetClient.GetDataDescriptions(out _dataDescriptor);

            if (result)
            {
                Logger.Info("Success: Data Descriptions obtained from the server.");
                ParseDataDescriptor(_dataDescriptor);
            }
            else
            {
                Logger.Info("Error: Could not get the Data Descriptions");
            }
        }
Exemple #3
0
        static void fetchDataDescriptor()
        {
            /*  [NatNet] Fetch Data Descriptions. Instantiate objects for saving data descriptions and frame data    */
            bool result = mNatNet.GetDataDescriptions(out mDataDescriptor);

            if (result)
            {
                log.Add("Success: Data Descriptions obtained from the server.");
                parseDataDescriptor(mDataDescriptor);
            }
            else
            {
                log.Add("Error: Could not get the Data Descriptions");
            }
            log.Add(" ");
        }