Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to create and move a hole at runtime on a simple quad terrain?

Discussion in 'Physics' started by dacohen, Aug 8, 2018.

  1. dacohen

    dacohen

    Joined:
    Apr 29, 2016
    Posts:
    1
    Hi. I'm having issues about how to create a hole and move it during runtime. The Physics should behave accordingly: if the hole moves below to an object, that object is expected to fall.
    Anyone here with experience knows how to give a good advice on this case?
    Thanks in advance!
     
  2. BoogieD

    BoogieD

    Joined:
    Jun 8, 2016
    Posts:
    236
    You could find the closest vertex in the mesh from mouse pointer etc. then find the associated vertices that define the edges of where the hole is supposed to be and alter their values so a hole is rendered. When the hole moves, the original height coordinates where the hole was last rendered will have to be reassigned so it ends up as it originally was.

    https://docs.unity3d.com/ScriptReference/Mesh.html