Skip to content


Away 3D – Constructing A Plane

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();
		}

	}
}

Posted in Actionscript 3, Away 3D.


One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. ícaro says

    Thanks for publish =D



Some HTML is OK

or, reply to this post via trackback.