Beispiel #1
0
        private void OnDestroy()
        {
            if (Trackable == null)
            {
                return;
            }

            m_AnchorDict.Remove(Trackable.GetDataBaseIndex());
        }
Beispiel #2
0
        /// <summary>
        /// Create a anchor for the trackable object
        /// </summary>
        /// <param name="trackable">Instantiate a NRAnchor object which Update trackable pose every frame</param>
        /// <returns>NRAnchor</returns>
        public static NRAnchor Factory(NRTrackable trackable)
        {
            if (trackable == null)
            {
                return(null);
            }

            NRAnchor result;

            if (m_AnchorDict.TryGetValue(trackable.GetDataBaseIndex(), out result))
            {
                return(result);
            }

            NRAnchor anchor = (new GameObject()).AddComponent <NRAnchor>();

            anchor.gameObject.name = "Anchor";
            anchor.Trackable       = trackable;

            m_AnchorDict.Add(trackable.GetDataBaseIndex(), anchor);
            return(anchor);
        }