29May

Away 3D - Constructing A Plane

1 comment so far

The construction of a plane. Roll your mouse over the movie below

Here is the document class used:

package
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import away3d.containers.*;
	import away3d.core.base.*;
	import away3d.primitives.*;
	import away3d.core.math.*;

	public class PlaneDemo extends Sprite
	{
		private var plane:Object3D;
		private var view:View3D;

		public function PlaneDemo()
		{
			// create a 3D-viewport
			// our movie is 700 x 700
			view = new View3D({x:350, y:350});

			// add viewport to the stage
			addChild(view);

			// create a plane
			plane = new Plane({material:"yellow#", name:"plane", y:-100, width:1000, height:1000, pushback:true});

			// add the plane to the scene
			view.scene.addChild(plane);

			// point camera at the plane
			view.camera.position = new Number3D(1000, 1000, 1000);
			view.camera.lookAt(plane.position);

			// create motion
			addEventListener(Event.ENTER_FRAME, Timeline);
		}

		private function Timeline(e:Event):void
		{
			plane.rotationY = mouseX / 2;
			plane.rotationX = mouseY / 2;

			// re render
			view.render();
		}

	}
}

Share/Save/Bookmark

Categories: Actionscript 3, Away 3D

Thursday, May 29th, 2008 at 1:01 pm and is filed under Actionscript 3, Away 3D. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response to “Away 3D - Constructing A Plane”

  1. Posted by ícaro 29th May, 2008 at 1:31 pm

    Thanks for publish =D

Leave a reply