Ejemplo n.º 1
0
        void Update()
        {
            // need to know if we touched the screen and where
            if (Input.touchCount > 0)
            {
                Vector3 touchPosition = Input.GetTouch(0).position;         // (x,y)
                if (raycastManager.Raycast(touchPosition, hits, TrackableType.PlaneWithinPolygon))
                {
                    var hitPose = hits[0].pose;

                    spawnedObject = Instantiate(prefab, hitPose.position, hitPose.rotation);

                    // need to assign button onClick functions
                    PlacedPrefab placedPrefab = spawnedObject.GetComponent <PlacedPrefab>();
                    placedPrefab.AddToModelAButton(modelAButton);
                    placedPrefab.AddToModelBButton(modelBButton);

                    // put our spawnedObject into our prefab manager list
                    PrefabManager.instance.AddPrefabs(spawnedObject);
                }
            }
        }
Ejemplo n.º 2
0
        void Update()
        {
            if (Input.touchCount > 0)
            {
                Touch touch = Input.GetTouch(0);

                Vector2 touchPosition = touch.position;
                if (touch.phase == TouchPhase.Began)
                {
                    Ray        ray = arCamera.ScreenPointToRay(touch.position);
                    RaycastHit hitObject;
                    if (Physics.Raycast(ray, out hitObject))
                    {
                        PlacedPrefab placementPrefab = hitObject.transform.GetComponent <PlacedPrefab>();

                        if (placementPrefab)
                        {
                            SelectedObject(placementPrefab);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
 void SelectedObject(PlacedPrefab selectedPrefab)
 {
     selectedPrefab.Selected = true;
 }