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

Adding rotational interactivity to an Away3D primitive by using Mouse movements

In this recipe, you will learn how to add basic interactivity to an Away3D primitive that is rotated according to Mouse movements on the screen. Although this feature is far from being rocket science, it is not uncommon to see an incorrect implementation of it in many applications which results in quite unnatural or imperfect behavior of interacted objects.

Getting ready

Set up a new Away3D scene extending our AwayTemplate class and you are ready to go.

How to do it...

In the next program, we create a typical Away3D sphere primitive. Our goal is to rotate the sphere around its x- and y- axis according to the mouse's x and y direction movement on the stage:

InteractiveRotate.as ...

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