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;
            }
        }
Exemple #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());
            }
        }
Exemple #3
0
 // Update is called once per frame
 void Update()
 {
     if (m_newData != null)
     {
         UbiUnityUtils.setGameObjectPose(relative, gameObject, m_newData);
         m_newData = null;
     }
 }
        void Update()
        {
            switch (ubitrackEvent)
            {
            case UbitrackEventType.Push: {
                SimplePose simplePose = UbiUnityUtils.getGameObjectPose(relative, gameObject);
                m_poseReciever.receivePose(simplePose);
                if (once)
                {
                    this.enabled = false;
                }
                break;
            }

            case UbitrackEventType.Pull:
            default:
                break;
            }
        }
        void FixedUpdate()
        {
            m_position = null;

            switch (ubitrackEvent)
            {
            case UbitrackEventType.Pull: {
                ulong lastTimestamp = UbiMeasurementUtils.getUbitrackTimeStamp();
                if (m_positionPull.getPosition3D(m_simplePosition, lastTimestamp))
                {
                    m_position = UbiMeasurementUtils.ubitrackToUnity(m_simplePosition);
                }
                break;
            }

            case UbitrackEventType.Push: {
                m_position = m_positionReceiver.getData();
                break;
            }

            default:
                break;
            }

            if (m_position != null)
            {
                UbiUnityUtils.setGameObjectPosition(relative, gameObject, m_position.data());
                m_lastData = m_position;
            }

            if (m_lastData != null)
            {
                ulong timeDiff             = UbiMeasurementUtils.getUbitrackTimeStamp() - m_lastData.time();
                float timeDiffMilliSeconds = (float)timeDiff * 1E-6f;
                m_timeout = timeDiffMilliSeconds > TimeoutInMilliSeconds;
            }
        }