I have structures made of voxels (cube gameobjects), and I want to make complex structures from them.

But I don't always want to place them on the grid. I want them to be more realistic, like diagonal:

enter image description here

(Don't mind those visual artifacts)

(If I would want to make a fortress like this on the grid, these diagonals would be ugly and zigzaggy.)

My problem is that due to this there would be double the voxels at the overlapping places. I want to remove every cube (for example from the selected wall object) which are being FULLY overlapped.

This way there won't be double voxels (only partially at the edges, which is fine) and it would look good as well.

How could I check this? I don't want to modify the structures manually because both the angle and the other object may vary, thus one structure would need lots of variations.

  • \$\begingroup\$ Presumably you looked into methods like Physics.OverlapBox? How have you tried implementing this check so far? \$\endgroup\$ – DMGregory Jun 15 '19 at 5:29
  • \$\begingroup\$ How could I determine by that how overlapped the object is? Because I just want to know when an object is fully overlapped. \$\endgroup\$ – Tudvari Jun 17 '19 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.