Search Unity

RealTime Plastic Shrink

Discussion in 'Scripting' started by unwshd_elend, Jun 13, 2020.

  1. unwshd_elend

    unwshd_elend

    Joined:
    Mar 21, 2019
    Posts:
    23
    Hello everyone , I really need your help for this...
    I have to create plastic vacuum effect in run-time (I linked a photo to see what I mean)
    first I tried creating it with unity built-in cloth system plus some shader to simulate plastics , but my objects have different variations and collision detecting is important so they wont go through the plastic.
    and I also I need the plastic to somehow shrink around them so I guess I need to go with mesh manipulation and change vertices... but I have no experience in this matter...
     
  2. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    Well, I'm not sure what you'll get for advice on this other than broad suggestions, since this feels pretty tricky to me. But one approach I might try is to reverse engineer the plastic mesh from the solid mesh. Let's assume that one bundle of peppers was a single mesh with 1000 verts. You could procedurally generate a mesh with 1000 corresponding verts, then expand it out so the verts started out more or less in a rectangular pattern. Then you'd move those verts close to the verts on the parent.

    This still sounds dreadfully messy, and you'll probably quickly realize that you're not getting some of the cool distinct visuals, such as the edges of the bag buckling, or the contents being compressed by the fact that the air is being pulled out of them. Anyway, good luck. Sounds pretty hard to do.
     
    unwshd_elend likes this.