3D Unity-Terrain realtime modifier

This question is outdated and no longer applies.

I’m trying to build a new mode for my upcoming game and require help, I need to find a voxel engine or programming solution for unity terrain to edit (at runtime). I also require help to be able to initiate game objects on a key press (at runtime).

Thanks,
Harley

You can calculate the point where the projectile hit the mesh. And then loop through all the vertices changing them.

You would need some sort of function to change them.

void ChangeVert(Vector3 hit, Vector3 vert)
{
  //This is 3D distance, you may want 2D distance.
  if((vert - hit).sqrMagnitude() < maxAffectDistance * maxAffectDistance)
  {
    //Change Vert
  }
}

Then iterate through them modifying them.

You may want to do other bookking, like tracking the differences from the original to set a max deformation range.

Some of this functionality exists in the built in Terrain type, but I’ve never tried modifying it at runtime.

sorry for the long reply(because my data became corrupted and i had to load a backup)I am not a great programmer(but i am trying to teach myself)So please can you put this in a script if i told you the details (like vertices and position) could you put it in a script or should i just ask around if you dont know???