Ejemplo n.º 1
0
    void CastSphere()
    {
        RaycastHit hit;

        if (Physics.SphereCast(transform.position, 1.0f, transform.TransformDirection(Vector3.down), out hit, 10))
        {
            float distanceToObstacle = hit.distance;
            Grow  grow = hit.transform.gameObject.GetComponent <Grow>();
            if (grow)
            {
                grow.Call();
            }
            Debug.Log("Spherecast distance: " + distanceToObstacle);
        }
    }