- Home /
Round edges of cubes?
Hi there!
I'm creating a game where the players need to build "Minecraft style" defensive structures to hold off waves of enemies. The level environment is NOT block based, so I was surprised how ugly these blocks look in my levels (even with nice materials).
Is there a way to let the blocks look less "cubish" (edged) without using custom models/meshes?
Ideally the blocks should have a slightly different shape depending on where they are placed. Blocks forming wall or floor should blend nicely while corner blocks should have round edges (see image).
Desired results:
If the only solution is to use custom meshes, is there a way to get around having a whole bunch of different block meshes for each possible block position?
I have to say that I'm pretty new to Unity and game development in general. Any help or general advices for my game idea are useful for me!
Thanks!
If you subdivide each block in 3x3 blocks, you need only two different (subdivided) blocks. One with 8 sharp edges and one with 7 sharp edges and a round corner. Rotate the latter so that the round corner points to the outside.
Great idea, thanks! But is there a way to still apply a single material as if all of the 27 sub cubes would be one single cube?
Answer by zwoxy · Mar 25, 2014 at 04:26 PM
I think that the easiest way is to use costum meshes. You can also make meshes in script but that would probably be a lot more comlicated. I would use a lot of different meshes as you said and then use raycast to se if there are blocks above, next to or under it.
I kind of like the idea to dynamically create the meshes. The meshes could probably be reused by storing them in a hash map... I will try to look into that!
Answer by Jroel · Sep 10, 2017 at 04:07 PM
Excellent tutorial for rounded cubes: http://catlikecoding.com/unity/tutorials/rounded-cube/