Bright Hub
 
Matthew Casperson's Hubfolio

Away3D Lite Programming Tutorials - Hover Camera

Article by Matthew Casperson (227,413 pts )
Published on Sep 22, 2009

Learn how to use the Away3D Lite hover camera to create a simple model viewing application.

Introduction

In the last article we looked at the target camera, which allows you to keep an object in view at all times. Here we will look at the hover camera, which allows you to view an object from any angle. It is useful for allowing a user to select the view of a 3D object.

Code Documentation

ApplicationManager.as

Most of this code is exactly the same as the target camera tutorial. The only difference is that we now create a new HoverCamera3D object, which is then assigned to the views camera property. [code]

The hover camera has 3 properties that the user will be able to modify at runtime. The first is the zoom, which works exactly like the zoom for the target camera. [code]

The second is the tiltAngle property. This sets the target tilt (up and down) angle of the camera. [code]

The third is the panAngle property. This sets the target pan (left and right) angle of the camera. [code]

Both the tiltAngle and panAngle properties only set the target angle of the camera. Setting these values alone does not actually change the angle of the camera. For that you need to call the hover function. The hover function will alter the cameras angles gradually towards the values specified by the tiltAngle and panAngle properties. This smooths the movement of the camera instead of making single jarring movements. However the hover function does take an optional Boolean value that can for the camera angle to the target angles in one movement. [code]

A3DL_HoverCamera.mxml

Here we have set up three sliders, one to modify the zoom, one to modify the pan angle, and one to modify the tilt angle. [code]

Final Words

The hover camera is a very useful class for interactively viewing 3D objects. By modifying the tilt and pan angles and the zoom a user can inspect a model from any angle with a simple and intuitive interface.

One thing that is worth mentioning is that the polygon popping that you see on the tank model is because of simplistic polygon sorting used by Away3D Lite. The full Away3D engine can fix this issue by using a renderer that splits intersecting polygons (see this article here), but this renderer is not part of the Away3D Lite engine. It’s a trade off between speed and accuracy, and Away3D Lite is focused on speed.

Go back to Away3D Tutorials

Related Files

Images

Screenshot

Next Article

Away3D Lite PrimitivesAway3D Lite Programming Tutorials - Primitives

Learn how to create the primitive 3D models that are included with the Away3D Lite engine.

Related Article

Away3D Hover CameraAway3D Programming Tutorials - Hover Camera

Learn how to add a hover camera to an Away3D scene.

Search More About:

 
Follow Matthew Casperson
Receive weekly updates from Matthew Casperson
 
Bright Hub - Science & Technology Articles, Buyer's Guides, How-To Tips and Software Reviews
About Bright Hub | Contact Us | Advertise with Us | Become a Writer | RSS | Site Map | Terms of Use | Privacy Policy | Copyright Policy
©2010 Bright Hub Inc. All rights reserved. Page copy protected against web site content infringement by Copyscape