20 Dec 2016

Selective explode in the viewer

Default blog image

    Here is a question that was asked by a developer during our last accelerator: How to exclude some components from being exploded in a model?

    Well, there is no API method directly exposed to achieve that, so I dig in the viewer source code and extracted the piece of code that handles the explosion transforms, then customized it a bit by adding an if condition that will prevent the passed fragment ids from being transformed.

    Here is the method, I named that selectiveExplode

    You can cut and paste that code here to quickly test it, simply replace the load method by this one with predefined fragment Ids:

    This will prevent the carburator ("Carb:1") from being exploded:

Screen Shot 2016-12-21 at 15.06.45

Related Article