0
\$\begingroup\$

So, forgive me if some of the terminology is wrong, I am just getting started with Unity again and I can't remember the proper names. I'm also on my phone, so I didn't have unity in front of me when I posted this question.

I am beginning work on a voxel based game. Everything in the game will be models constructed of 64 by 64 cubes. I would like to, with the code given, say, a 4096 bit array, be able to construct a model in the game with those cubes. I know that you can programmatically add models that you have imported into unity, but I want to make contiguous meshes programmatically, with highest performance being the goal. I do not want a certain amount of little 1x1 cube meshes positioned right next to each other, but specifically one model.

Is this possible?

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Yes, it's possible. You can use the Mesh class to dynamically create whatever shapes you want. The efficient construction of a mesh from a list of voxels is not trivial though, so a complete solution is likely to be too long for an answer. My advice would be to make a start yourself, and if you run into trouble, ask a question specific to the snag you've hit. \$\endgroup\$
    – DMGregory
    Commented Dec 1, 2015 at 15:41
  • \$\begingroup\$ "Is this possible?" is just a yes or no question; you should ask "how?" \$\endgroup\$
    – jhocking
    Commented Jan 1, 2016 at 1:41

1 Answer 1

1
\$\begingroup\$

I would suggest checking out AlexStv's Voxel Tutorial. It's written for C# in Unity3d, has been iterated upon several times, and covers everything from generating the meshes and texture up through setting up collisions and integrating a first-person camera.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .