示例#1
0
    void DetectRemoveVoxel()
    {
        if (!Input.GetMouseButtonDown(0))
        {
            return;
        }

        RaycastHit hit;

        if (Physics.Raycast(transform.position, transform.forward, out hit, max_edit_distance))
        {
            Terraformer.SetVoxel(hit, new VoxelAir());//replace with air
        }
    }
示例#2
0
    void DetectPlaceVoxel()
    {
        if (!Input.GetMouseButtonDown(1))
        {
            return;
        }

        RaycastHit hit;

        if (Physics.Raycast(transform.position, transform.forward, out hit, max_edit_distance))
        {
            Terraformer.SetVoxel(hit, block_to_place.Clone(), true);//place in adjacent
        }
    }