- Home /
terrain alteration a.k.a. digging
I know digging digging is impossible in unity, although is there any possible form of in-game terrain alteration, for example lowering the terrain at certain point by certain amount, maybe with certain radius - just like using brushes in the terrain toolkit.
Also, about the true digging part, is there any way other than making millions of game objects stacked one on each other that disappear on mouse click? that would probably kill my pc, unless new objects would appear only after previous ones were destroyed. That would keep their number at the same level (which is bad anyways)
Answer by testure · Jul 19, 2011 at 06:40 AM
If you don't mind dropping a little cash on it (it's pretty inexpensive, for what it does), then VoxelForm is a turnkey solution:
Here's the demo: http://cyclopsframework.org/voxelform/
Answer by SilverTabby · Jul 19, 2011 at 05:08 AM
Yes, modifying a terrain mesh, or any mesh at all, is possible in game. There is even an example provided by unity on the subject.
Yes, it is possible to create a minecraft clone in unity by creating/placing objects proceduraly using prefabs and Instantiate.
You can simply use a Raycast to find the gameobject in the center of the screen/at the mouse coordinates/on the other side of the gun/etc. and then work with and on that object.
It shouldn't be too hard to only make the blocks appear when an adjacent one is destroyed.
All of these things are possible. You just have to do the actual work yourself.
Unity terrains don't use meshes, they use heightmaps. ($$anonymous$$eshes for the terrain are generated dynamically at runtime, but you have no control over them, you only have control over the heightmap.) $$anonymous$$aking a $$anonymous$$inecraft clone by instantiating prefabs is a bad idea, since the performance would be terrible unless you had a very small area. There are a few topics on the Unity forums that discuss how to create $$anonymous$$inecraft clones by using procedural meshes.
Answer by Simon Wittber · Feb 08, 2012 at 04:22 AM
Terrain Destruction is a simple cheap package which can dig holes at runtime.