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

Drawing with segments in 3D

Segments in 3D are lines that build a mesh of the object, which is then covered with faces. Basically, these are 2D objects which can also be manipulated in 3D. In the following recipe, we will create a simple drawing application where we are going to paint our scene with a segment brush.

Getting ready

Set up a basic Away3D scene using AwayTemplate and we can start.

How to do it...

SegmentDrawDemo.as

package { public class SegmentDrawDemo extends AwayTemplate { private var _container:Mesh; private var _canDraw:Boolean=false; private var _seg:Segment; private var _hoverCam:HoverCamera3D; private var _oldMouseX:Number=0; private var _oldMouseY:Number=0; private var _canMove:Boolean=true; public function SegmentDrawDemo() ...

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