Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    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:
    179
    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