Example #1
0
        void onMarkerVisible(MarkerInfo m)
        {
            if (m.name == markerToListen)
            {
                child?.SetActive(true);
                uiHelper?.SetActive(false);
                gameUI?.SetActive(true);

                if (!firstTime)
                {
                    if (Vector3.Distance(m.position, transform.position) > positionThreshold)
                    {
                        transform.position = Vector3.Lerp(transform.position, m.position, Time.deltaTime * updateSpeed);
                    }
                }
                else
                {
                    transform.position = m.position;
                    firstTime          = false;
                }

                transform.rotation = m.rotation;

                Vector3 absScale = new Vector3(
                    Mathf.Abs(m.scale.x),
                    Mathf.Abs(m.scale.y),
                    Mathf.Abs(m.scale.z)
                    );

                transform.localScale = absScale;
            }
        }
Example #2
0
 void onMarkerLost(MarkerInfo m)
 {
     if (m.name == currentMarker)
     {
         child.SetActive(false);
         firstTime = true;
     }
 }
Example #3
0
 void onMarkerLost(ARWT.Marker.MarkerInfo m)
 {
     if (m.name == markerToListen)
     {
         target?.SetActive(false);
         TXT_Tip?.gameObject.SetActive(true);
         firstTime = true;
     }
 }
Example #4
0
 void onMarkerLost(MarkerInfo m)
 {
     if (m.name == markerToListen)
     {
         child?.SetActive(false);
         uiHelper?.SetActive(true);
         gameUI?.SetActive(false);
         firstTime = true;
     }
 }
Example #5
0
        void onMarkerVisible(MarkerInfo m)
        {
            if (markers.Contains(m.name))
            {
                currentMarker = m.name;
                child.SetActive(true);

                if (!firstTime)
                {
                    transform.position = Vector3.Lerp(transform.position, m.position, Time.deltaTime * updateSpeed);
                }
                else
                {
                    transform.position = m.position;
                    firstTime          = false;
                }

                transform.rotation   = m.rotation;
                transform.localScale = m.scale;
            }
        }
        public void markerInfos(string infos)
        {
            string[] datas = infos.Split(","[0]);

            string name      = datas[0].Trim();
            bool   isVisible = bool.Parse(datas[1]);
            float  posX      = float.Parse(datas[2].ToString());
            float  posY      = float.Parse(datas[3].ToString());
            float  posZ      = float.Parse(datas[4].ToString());
            float  rotX      = float.Parse(datas[5].ToString());
            float  rotY      = float.Parse(datas[6].ToString());
            float  rotZ      = float.Parse(datas[7].ToString());
            float  rotW      = float.Parse(datas[8].ToString());
            float  scaX      = float.Parse(datas[9].ToString());
            float  scaY      = float.Parse(datas[10].ToString());
            float  scaZ      = float.Parse(datas[11].ToString());

            MarkerInfo m = new MarkerInfo(
                name,
                isVisible,
                new Vector3(posX, posY, posZ),
                new Quaternion(rotX, rotY, rotZ, rotW),
                new Vector3(scaX, scaY, scaZ)
                );

            if (onMarkerDetected != null)
            {
                onMarkerDetected(m);
            }

            if (onMarkerVisible != null && m.isVisible)
            {
                onMarkerVisible(m);
            }

            if (onMarkerLost != null && !m.isVisible)
            {
                onMarkerLost(m);
            }
        }