O'Reilly logo

Away3D 3.6 Cookbook by Michael Ivanov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exploding geometry

It may be useful in certain scenarios to know how to blow your objects into pieces, especially when you work on a shooter game. We can blow up the geometry in Away3D in a relatively easy way using a utility class Explode, which is located in the away3d.tools package. So let's go through a quick demolition course.

Getting ready

As usual, set up a basic scene using the AwayTemplate class and you're ready to go.

How to do it...

In the following program, we create a regular sphere primitive. Then we trigger its explosion to pieces that are mesh triangles:

SimpleExplode.as

package { public class SimpleExplode extends AwayTemplate { private var _explodeContainer:ObjectContainer3D; private var _sphere:Sphere; private var _light:PointLight3D; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required