Pull Apart


I have question, how to make feature in unity like image i attach, so basically when i slide on GUI, object on the children of my model automatic pull.

What you want here is an exploded view. However there’s not really a way to fully automate this for an arbitrary mesh / object and have the parts still nicely aligned.

However you can simply move the parts outwards from the centerpoint. Of course this will only work if your “parts” are actual seperate objects. If your model is a single mesh it’s not possible as there’s no information which “triangles” belong to the same object.

As pseudo code it would look something like:

foreach part
    part.position = centerPoint + (part.originalPosition - centerPoint) * distance

So all you need is to store the original position of each part so you can update the current position this way. The “distance” value would determine how far the objects are apart. The normal value is “1” in which case the objects are in their original positions. If the distance is “0” all objects would collapse to the center point. If it’s greater than 1 they will move outwards.