Exemplo n.º 1
0
 void ChangeSelectedObject(PlaCement0bject selected)
 {
     foreach (PlaCement0bject current in placedObject)
     {
         MeshRenderer meshRenderer = current.GetComponent <MeshRenderer>();
         if (selected != current)
         {
             current.IsSelected = false;
         }
         else
         {
             current.IsSelected = true; InfoPlanet.SetActive(true);
         }
     }
 }
Exemplo n.º 2
0
    void Update()
    {
        if (Input.touchCount > 0)
        {
            Touch touch = Input.GetTouch(0);
            touchPosition = touch.position;

            if (touch.phase == TouchPhase.Began)
            {
                Ray        ray = arCamera.ScreenPointToRay(touch.position);
                RaycastHit hitObject;
                if (Physics.Raycast(ray, out hitObject))
                {
                    //Находит объект, к которому прикреплен компонент, затем находит Компонент, прикрепленный с этим объектом
                    PlaCement0bject placementObject = hitObject.transform.GetComponent <PlaCement0bject>();
                    if (placementObject != null)
                    {
                        ChangeSelectedObject(placementObject);
                    }
                }
            }
        }
    }