How do I make a terraforming system?

Hi everybody,

I’m currently working on a low poly game in which the user has a toolgun which can modify the world around the player. This toolgun should be able to dig holes (in 3D space) and also raise/fill the world (back) up. I though that this can be done be deforming the mesh, but I am not able to find a tutorial that suits my needs.

I have found a video of what the system that I want is bigger lines. In this video the player can do as described and the mesh also gets subdived to keep everything look normal. Although the person in this video uses different planes for the deformation, I’d like to do the on one mesh if possible.

My terrain is a procedurally generated mesh which I created by following the tutorials of Brackeys. It is a single mesh and this not a Unity terrain. Ohh, and the position of where the terraforming should take place is being found by a raycast hit :slight_smile:

Does anyone have any experience with this system?

Thanks upfront and merry Christmas,

The Brackeys tutorial is letting you spawn quads, then setting their heights. If you can live without tunneling, you can just modify the vertices Y positions near your raycasthit and regenerate the mesh.

It’s not too hard to get the worldposition for a vertex in Unity. Unity - Scripting API: Transform.TransformPoint

If you want the tunneling, you’re using the wrong technique for terrain rendering. The video you showed seems to be using marching cubes, which is a whole different ballgame.