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 } }
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 } }