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

Masking 3D objects

Sometimes you may wish to mask a 3D object just as you would normally do with regular 2D flash graphics. In this recipe, you will learn how to mask a 3D geometry. In Away3D, you can achieve this by accessing the sprite container that wraps a particular 3D model. This way, you can create a wide range of mask effects for your project.

Getting ready

Just set up an Away3D scene using the AwayTemplate class and you are good to go.

How to do it...

In this program, we create two spheres and set them one on top of another, then apply two different materials to them. We mask one of the spheres with a cube primitive, which we then tween over it in order to reveal the masked sphere:

ViewMasking.as

package { public class ViewMasking extends ...

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