protected void processData()
        {
            if (m_pose != null)
            {
                UbiUnityUtils.setGameObjectPose(relative, gameObject, m_pose.data());

                if (m_lastData != null)
                {
                    Vector3 posDiff  = m_pose.data().pos - m_lastData.data().pos;
                    ulong   timeDiff = m_pose.time() - m_lastData.time();

                    float timeDiffSeconds = (float)timeDiff * 1E-9f;

                    m_meanPosVelocity = posDiff.magnitude / timeDiffSeconds;
                }

                m_lastData = m_pose;

                triggerPull(m_pose.time());
            }


            if (m_lastData != null)
            {
                ulong timeDiff             = UbiMeasurementUtils.getUbitrackTimeStamp() - m_lastData.time();
                float timeDiffMilliSeconds = (float)timeDiff * 1E-6f;
                m_timeout = timeDiffMilliSeconds > TimeoutInMilliSeconds;
            }
        }
Example #2
0
        void FixedUpdate()
        {
            m_pose = null;

            switch (ubitrackEvent)
            {
            case UbitrackEventType.Pull: {
                ulong lastTimestamp = UbiMeasurementUtils.getUbitrackTimeStamp();
                if (m_posePull.getPose(m_simplePose, lastTimestamp))
                {
                    m_pose = UbiMeasurementUtils.ubitrackToUnity(m_simplePose);
                }
                break;
            }

            case UbitrackEventType.Push: {
                m_pose = m_poseReceiver.getData();
                break;
            }

            default:
                break;
            }

            if (m_pose != null)
            {
                UbiUnityUtils.setGameObjectPose(relative, gameObject, m_pose.data());
            }
        }
Example #3
0
 // Update is called once per frame
 void Update()
 {
     if (m_newData != null)
     {
         UbiUnityUtils.setGameObjectPose(relative, gameObject, m_newData);
         m_newData = null;
     }
 }