Model decompose

Hi Have anyone seen this kind effect forge

click the decompose button, the mode will get decomposed or exploded.
I am trying to do the same thing, here is what I’m thinking about.

Traverse every entities within the model and move each entity in the direction point outwards from the center of the model bounding box to the center of entity itself?

for each entity within the model

  1. posA = Get the position of the entity center
  2. posB = Get the position of the model bounding box.
  3. Calculate the direction vector point from posB to pos A
  4. Translate the entity

But the steps mentioned above can not achieve the similar result, Any thoughts? suggestions?

If you translate every entity along a world space direction vector it will only work if an entity has no parent. In all other cases, the transformation of ancestors will affect an entity and probably break your code.

1 Like