Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        curObjects = blocks.Count;
        if (Input.GetMouseButtonDown(0) && itemSelected != null)
        {
            RaycastHit hit;
            Ray        ray = camera.ScreenPointToRay(Input.mousePosition);

            if (Physics.Raycast(ray, out hit))
            {
                Transform  objectHit = hit.transform;
                GameObject objectl   = hit.transform.gameObject;
                GridSlot   gridSlot  = objectl.GetComponent <GridSlot>();
                placeObject(hit.transform.position, gridSlot);
                Debug.Log(gridSlot.getPosition());
                // Do something with the object that was hit by the raycast.
            }
        }
    }