예제 #1
0
    private void SpawnOnPlayer()
    {
        RaycastHit hit;
        var        ray = new Ray(Player.GetComponent <Rigidbody>().transform.position, Vector3.down);

        if (!Physics.Raycast(ray, out hit, 3.0f))
        {
            return;
        }

        Cube.transform.position = hit.collider.transform.position + Vector3.up * SpawnHeight;
        CubeSpawner.addCube(Instantiate(Cube, FloorTransform));
    }