Papervision3D Tutorial Part 2: Basic shapes, movement and segments

[Update 15/10/2009] The most comprehensive work about Papervision3D is this book.

This beginner’s tutorial is a follow up on part 1 where we set up a basic project and imported a Collada file to the scene. This tutorial will focus on adding multiple Papervision3D objects and making them move. There’s also a little bit on segments and linear texture mapping.

Now let us start with the basics.

  • create a new ActionScript project, name it “Papervision3DTutorial2″ and type “source” in the wizard’s “main source folder” input field
  • create a folder called “assets” in the project root
  • get the latest version of Papervision3D (see tutorial 1) and put it in the “source” folder
  • copy and paste the following code into Papervision3DTutorial2.as:
		
package {
	import flash.display.Sprite;
	import flash.events.Event;

	import org.papervision3d.cameras.Camera3D;
	import org.papervision3d.objects.Cube;
	import org.papervision3d.objects.DisplayObject3D;
	import org.papervision3d.scenes.Scene3D;

	[SWF(backgroundColor="#000000", frameRate="60")]

	/**
	 * Papervision3dTutorial2.as
	 * 05 April 2007
	 * @author Dennis Ippel - rozengain.com
	 */
	public class Papervision3DTutorial2 extends Sprite
	{
		private var myMaterials:Object;
		private var container:Sprite;
		private var scene:Scene3D;
		private var camera:Camera3D;
		private var rootNode:DisplayObject3D;

		/**
		 * Constructor
		 */
		public function Papervision3DTutorial2()
		{
			// initialize the objects
			init3D();

			// add a listener for the 3D loop
			addEventListener(Event.ENTER_FRAME, loop3D);
		}

		/**
		 * Creates the container, scene, camera and root node
		 */
		private function init3D():void {
			// create the container, add it to the stage, position it
			container = new Sprite();
			addChild( container );

			container.x = 200;
			container.y = 200;

			// create a new scene and use the container
			scene = new Scene3D( container );

			// create a new camera and position it
			camera = new Camera3D();
			camera.x = 3000;
			camera.z = -300;
			camera.zoom = 10;
			camera.focus = 100;

			// add a root node to the scene
			rootNode = scene.addChild( new DisplayObject3D("rootNode") );
		}

		/**
		 * The 3D animation loop
		 * @param event
		 */
		private function loop3D( event:Event ):void {
			// render the camera to see the changes
			scene.renderCamera( camera );
		}
	}
}

This doesn’t do anything yet, it just initializes the basic objects. Next we will insert a colored cube. Add these line of code just before the end of the init3D function:

		
var cubeMaterials:MaterialsList = new MaterialsList();
cubeMaterials.addMaterial( new ColorMaterial( 0x990000 ), "all" ); // "all" indicates that this material should be used on all sides of the cube
rootNode.addChild( new Cube( cubeMaterials, 200, 200, 200, 8, 8, 8 ), "myCube01" );

Make sure you’ve also added this line to your imports:

		
import org.papervision3d.objects.Cube;
import org.papervision3d.materials.MaterialsList;
import org.papervision3d.materials.ColorMaterial;

(Flex) Build and run the project. (Flash) Make the document class point to the ActionScript file we just created). You should now see a red cube somewhere in the middle of the screen:

Cube 1

“Cube” is a standard Papervision3D object that you can find in the org.papervision3d.objects package. Later on, we’ll add another object from the same package.

The parameters that are passed into the constructor are:

  • material: in this case I used ColorMaterial. In the next step we’ll add a texture to the cube
  • width
  • depth
  • height
  • three segment values. I’ll talk about this later on

Texture

Now we’ll add a texture to the cube. Download this file and save it to the “assets” folder.

[Flex] (skip to the Flash part)

Add this line of code just before the constructor to embed this .png file in the project:

		[Embed(source="../assets/cubetexture.png")] private var CubeTexture:Class;

Go to the line where you just added the cube. Place this bit of code just before that line:

		var cubeTexture:Bitmap = new CubeTexture() as Bitmap;

This creates a new instance of our cubetexture.png file and casts it to a Bitmap. Now we can pass this Bitmap’s bitmapData to the Cube constructor. Remove the ColorMaterial bit and replace it with BitmapMaterial:

		
cubeMaterials.addMaterial( new BitmapMaterial( cubeTexture.bitmapData ), "all" );

Be sure the import statement for BitmapMaterial is added to the class.

[Flash]

Flash users should import the PNG to the library and use the class name “CubeTexture” in the symbol’s linkage properties.

Now remove the ColorMaterial bit and replace it with BitmapAssetMaterial:

		
cubeMaterials.addMaterial( new BitmapAssetMaterial( "CubeTexture" ), "all" );

Be sure the import statement for BitmapAssetMaterial is added to the class.

Build the project and run it. You should now see a textured cube:

Cube 1

Rotation

Now we’ll add some movement to the cube object. Just some basic stuff, we’ll make it move around it’s x- and y-axis. All that’s needed is this code in loop3d():

		var myCube01:DisplayObject3D = rootNode.getChildByName( "myCube01" );

if( myCube01 != null ) {
	myCube01.rotationX++;
	myCube01.rotationY++;
}

The first line returns the child object that we just added to the rootNode object. The name that’s passed to the getChildByName method corresponds to the name we passed to the Cube constructor. After that we’re able to rotate the thing.

Put in another Cube

Because one is never enough, we’ll have to put in a second cube.
Save this file into the assets folder.

[Flex] (skip to the Flash part)

Embed it just like we did with the other texture:

		[Embed(source="../assets/psychedelictexture.png")] private var PsychedelicTexture:Class;

Now we’ll create a new Cube object and add it to the scene:

		
var psychedelicTexture:Bitmap = new PsychedelicTexture() as Bitmap;
var cube2Materials:MaterialsList = new MaterialsList();
cube2Materials.addMaterial( new BitmapMaterial( psychedelicTexture.bitmapData ), "all" );
var myCube02:DisplayObject3D = rootNode.addChild( new Cube( cube2Materials, 200, 200, 200, 8, 8, 8 ), "myCube02" );

[Flash]

Import the PNG to the library and use the class name “PsychedelicTexture” in the symbol’s linkage properties.

Now we’ll create a new Cube object and add it to the scene:

		
var cube2Materials:MaterialsList = new MaterialsList();
cube2Materials.addMaterial( new BitmapAssetMaterial( "PsychedelicTexture" ), "all" );
var myCube02:DisplayObject3D = rootNode.addChild( new Cube( cube2Materials, 200, 200, 200, 8, 8, 8 ), "myCube02" );

Notice that we’re doing something different here. When we call the addChild method it returns a reference to the newly created object. We can use this reference to change the cube’s position. Insert these lines just after the previous statement:

		myCube02.moveForward( 600 );
myCube02.moveRight( 600 );

This changes the Cube’s position. Now we’ll make it rotate on the x- and z-axis. Add this code to loop3D:

		var myCube02:DisplayObject3D = rootNode.getChildByName( "myCube02" );

if( myCube02 != null ) {
	myCube02.rotationX++;
	myCube02.rotationZ++;
}

Nothing new here. We now have two rotating cubes in our scene. To make it a bit more fun to look at we’ll also make the rootNode rotate around its y-axis. Add this line also to loop3D:

		rootNode.rotationY += 3;

Now build and launch. You should see this:

Cube 3

If you have an old computer like me (2.0 Ghz Pentium 4) you’ll see that the movement isn’t very smooth. We can solve this by changes some values. Change these lines:

[Flex & Flash]

		
rootNode.addChild( new Cube( cubeMaterials, 200, 200, 200, 8, 8, 8 ), "myCube01" );
...
var myCube02:DisplayObject3D = rootNode.addChild( new Cube( cubeMaterials, 200, 200, 200, 8, 8, 8 ), "myCube02" );

into:

		
rootNode.addChild( new Cube( cubeMaterials, 200, 200, 200, 1, 1, 1 ), "myCube01" );
...
var myCube02:DisplayObject3D = rootNode.addChild( new Cube( cubeMaterials, 200, 200, 200, 1, 1, 1 ), "myCube02" );

Run and rebuild … see the improvement? Let me explain what’s happened. The three parameter values you’ve just changed are segment values. Segments divide the cube’s faces into smaller parts. This is necessary to prevent texture distortion. More segments will cause less distortion but will demand more of your computer’s processor. This technique is called linear texture mapping and you can read about it here. Carlos Ulloa has a demonstration of this technique.

Another object: Cylinder

Now let’s add another shape to our scene. A cylinder would be nice. Download this texture to the assets folder.

[Flex] (skip to the Flash part)

Add the following code:

		[Embed(source="../assets/cylindertexture.png")] private var CylinderTexture:Class;
...
var cylinderTexture:Bitmap = new CylinderTexture() as Bitmap;
var myCylinder:DisplayObject3D = rootNode.addChild( new Cylinder( new BitmapMaterial( cylinderTexture.bitmapData ), 100, 400, 1, 1, 0 ), "myCylinder" );
myCylinder.moveBackward( 600 );
myCylinder.moveLeft( 600 );

[Flash]

Add the PNG to the library and give it the class name “CylinderTexture”. Add the following code:

		
var myCylinder:DisplayObject3D = rootNode.addChild( new Cylinder( new BitmapAssetMaterial( "CylinderTexture" ), 100, 400, 1, 1, 0 ), "myCylinder" );
myCylinder.moveBackward( 600 );
myCylinder.moveLeft( 600 );

Does this look like a cylinder?

Cylinder 1

No!! Why? Because we passed 1 as a value for the segments. Change them to 8 and you’ll see that it looks much more like a cylinder now:

Cylinder 1

That’ll be the end of this second tutorial. This is the final Flex version:

		
package {
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.events.Event;

	import org.papervision3d.cameras.Camera3D;
	import org.papervision3d.materials.BitmapMaterial;
	import org.papervision3d.materials.ColorMaterial;
	import org.papervision3d.objects.Cube;
	import org.papervision3d.objects.Cylinder;
	import org.papervision3d.objects.DisplayObject3D;
	import org.papervision3d.scenes.Scene3D;
	import org.papervision3d.materials.MaterialsList;

	[SWF(backgroundColor="#000000", frameRate="60")]

	/**
	 * Papervision3dTutorial2.as
	 * 05 April 2007
	 * @author Dennis Ippel - rozengain.com
	 */
	public class Papervision3DTutorial2 extends Sprite
	{
		private var myMaterials:Object;
		private var container:Sprite;
		private var scene:Scene3D;
		private var camera:Camera3D;
		private var rootNode:DisplayObject3D;

		// Embed these png files into the swf
		[Embed(source="../assets/cubetexture.png")] private var CubeTexture:Class;
		[Embed(source="../assets/psychedelictexture.png")] private var PsychedelicTexture:Class;
		[Embed(source="../assets/cylindertexture.png")] private var CylinderTexture:Class;
		/**
		 * Constructor
		 */
		public function Papervision3DTutorial2()
		{
			// initialize the objects
			init3D();

			// add a listener for the 3D loop
			addEventListener(Event.ENTER_FRAME, loop3D);
		}

		/**
		 * Creates the container, scene, camera and root node
		 */
		private function init3D():void {
			// create the container, add it to the stage, position it
			container = new Sprite();
			addChild( container );

			container.x = 200;
			container.y = 200;

			// create a new scene and use the container
			scene = new Scene3D( container );

			// create a new camera and position it
			camera = new Camera3D();
			camera.x = 3000;
			camera.z = -300;
			camera.zoom = 10;
			camera.focus = 100;

			// add a root node to the scene
			rootNode = scene.addChild( new DisplayObject3D("rootNode") );

			// create a textured cube
			var cubeTexture:Bitmap = new CubeTexture() as Bitmap;
			var cubeMaterials:MaterialsList = new MaterialsList();
			cubeMaterials.addMaterial( new BitmapMaterial( cubeTexture.bitmapData ), "all" );
			rootNode.addChild( new Cube( cubeMaterials, 200, 200, 200, 1, 1, 1 ), "myCube01" );

			// create another textured cube
			var psychedelicTexture:Bitmap = new PsychedelicTexture() as Bitmap;
			var cube2Materials:MaterialsList = new MaterialsList();
			cube2Materials.addMaterial( new BitmapMaterial( psychedelicTexture.bitmapData ), "all" );
			var myCube02:DisplayObject3D = rootNode.addChild( new Cube( cube2Materials, 200, 200, 200, 1, 1, 1 ), "myCube02" );
			// position the cube
			myCube02.moveForward( 600 );
			myCube02.moveRight( 600 );

			// create a cylinder
			var cylinderTexture:Bitmap = new CylinderTexture() as Bitmap;
			var myCylinder:DisplayObject3D = rootNode.addChild( new Cylinder( new BitmapMaterial( cylinderTexture.bitmapData ), 100, 400, 8, 8, 0 ), "myCylinder" );
			// position it
			myCylinder.moveBackward( 600 );
			myCylinder.moveLeft( 600 );
		}

		/**
		 * The 3D animation loop
		 * @param event
		 */
		private function loop3D( event:Event ):void {
			// get the references to our objects
			var myCube01:DisplayObject3D = rootNode.getChildByName( "myCube01" );
			var myCube02:DisplayObject3D = rootNode.getChildByName( "myCube02" );

			// move them
			if( myCube01 != null ) {
				myCube01.rotationX++;
				myCube01.rotationY++;
			}

			if( myCube02 != null ) {
				myCube02.rotationX++;
				myCube02.rotationZ++;
			}

			// rotate the root node
			rootNode.rotationY++;
			// render the camera to see the changes
			scene.renderCamera( camera );
		}
	}
}

.. and this is the final Flash version:

		
package {
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.events.Event;

	import org.papervision3d.cameras.Camera3D;
	import org.papervision3d.materials.BitmapAssetMaterial;
	import org.papervision3d.materials.ColorMaterial;
	import org.papervision3d.objects.Cube;
	import org.papervision3d.objects.Cylinder;
	import org.papervision3d.objects.DisplayObject3D;
	import org.papervision3d.scenes.Scene3D;
	import org.papervision3d.materials.MaterialsList;

	/**
	 * Papervision3dTutorial2.as
	 * 05 April 2007
	 * @author Dennis Ippel - rozengain.com
	 */
	public class Papervision3DTutorial2 extends Sprite
	{
		private var myMaterials:Object;
		private var container:Sprite;
		private var scene:Scene3D;
		private var camera:Camera3D;
		private var rootNode:DisplayObject3D;

		/**
		 * Constructor
		 */
		public function Papervision3DTutorial2()
		{
			// initialize the objects
			init3D();
			// add a listener for the 3D loop
			addEventListener(Event.ENTER_FRAME, loop3D);
		}

		/**
		 * Creates the container, scene, camera and root node
		 */
		private function init3D():void {
			// create the container, add it to the stage, position it
			container = new Sprite();
			addChild( container );

			container.x = 200;
			container.y = 200;

			// create a new scene and use the container
			scene = new Scene3D( container );

			// create a new camera and position it
			camera = new Camera3D();
			camera.x = 3000;
			camera.z = -300;
			camera.zoom = 10;
			camera.focus = 100;

			// add a root node to the scene
			rootNode = scene.addChild( new DisplayObject3D("rootNode") );

			// create a textured cube
			var cubeMaterials:MaterialsList = new MaterialsList();
			cubeMaterials.addMaterial( new BitmapAssetMaterial( "CubeTexture" ), "all" );
			rootNode.addChild( new Cube( cubeMaterials, 200, 200, 200, 1, 1, 1 ), "myCube01" );

			// create another textured cube
			var cube2Materials:MaterialsList = new MaterialsList();
			cube2Materials.addMaterial( new BitmapAssetMaterial( "PsychedelicTexture" ), "all" );
			var myCube02:DisplayObject3D = rootNode.addChild( new Cube( cube2Materials, 200, 200, 200, 1, 1, 1 ), "myCube02" );
			// position the cube
			myCube02.moveForward( 600 );
			myCube02.moveRight( 600 );

			// create a cylinder
			var myCylinder:DisplayObject3D = rootNode.addChild( new Cylinder( new BitmapAssetMaterial( "CylinderTexture" ), 100, 400, 8, 8, 0 ), "myCylinder" );
			// position it
			myCylinder.moveBackward( 600 );
			myCylinder.moveLeft( 600 );
		}

		/**
		 * The 3D animation loop
		 * @param event
		 */
		private function loop3D( event:Event ):void {
			// get the references to our objects
			var myCube01:DisplayObject3D = rootNode.getChildByName( "myCube01" );
			var myCube02:DisplayObject3D = rootNode.getChildByName( "myCube02" );

			// move them
			if( myCube01 != null ) {
				myCube01.rotationX++;
				myCube01.rotationY++;
			}

			if( myCube02 != null ) {
				myCube02.rotationX++;
				myCube02.rotationZ++;
			}

			// rotate the root node
			rootNode.rotationY++;
			// render the camera to see the changes
			scene.renderCamera( camera );
		}
	}
}

I hope you enjoyed this tutorial and I hope it made you even more enthusiastic about Papervision3D’s possibilities. Your feedback is more than welcome, ofcourse.

  • Delicious
  • Facebook
  • Digg
  • Reddit
  • StumbleUpon
  • Twitter

47 thoughts on “Papervision3D Tutorial Part 2: Basic shapes, movement and segments

  1. Great Tut man. Very nicely laid out and simple to follow. Now I get alot of requests from people wanting to put flex components into a papervision scene….car to do a tut on that? :)

  2. blulightjr says:

    Very helpful tutorial but I keep getting this error at runtime.

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at Papervision3DTutorial2/::init3D()
    at Papervision3DTutorial2$iinit()

  3. danix says:

    dennis thx for the great tut.

    the first piece of code posted is missing the line-
    camera = new Camera3D();

    my guess is thats why Blulightjr is getting that err …

  4. Great tutorials. Please make us more! :)
    First one went great.
    I am running into problems with this one though. I saved the images into the assets folder, i pasted the final code you offered above into the .as and when I run it, i get this in the problems window:

    unable to resolve ‘../assets/psychedelictexture.png’ for transcoding
    unable to resolve ‘../assets/cylindertexture.png’ for transcoding
    unable to resolve ‘../assets/cubetexture.png’ for transcoding

  5. Great tutorials. Please make us more! :)
    First one went great.
    I am running into problems with this one though. I saved the images into the assets folder, i pasted the final code you offered above into the .as and when I run it, i get this in the problems window:

    unable to resolve ‘../assets/psychedelictexture.png’ for transcoding
    unable to resolve ‘../assets/cylindertexture.png’ for transcoding
    unable to resolve ‘../assets/cubetexture.png’ for transcoding

  6. Chris,
    Did you create an “assets” and a “source” folder in the project root? The png files should be in the “assets” folder and Papervision3DTutorial2.as should be in the “source” folder.

  7. anonym says:

    There is a missing line in the first code:

    import org.papervision3d.materials.ColorMaterial;

    Because when we add the cube to the init(), it gives an error (logic loll)

    Thinks for this tuto.

  8. anonym says:

    Hi, just add :
    import flash.display.Bitmap;
    When you change the color of the cube to a texture.

    Your tutorial is great, for zhen the next one !!!!!!!!!!!

  9. Peter says:

    To get it to work for my I had to do the following:
    1. Create a shape (a small box i guess) on the stage (in flash cs3 that is, not flex)
    2. Right click and select Convert to symbol…
    3. Select Type as Movie Clip
    4.. Then I also ticked the “Linkage: Export For Actionscript” button
    4. This then allows you to enter in the class that we are writing above (in this tutorial) that is we are linking a class (class Papervision3DTutorial2 { …) to an object (our movie clip)
    5. Then if we test our movie you should see the red cube!

  10. Anonymous says:

    However…. when I try to add the tecture to the cube i get the following error:

    Constructor Called
    init3D() Called
    Papervision3D Beta RC1 (09.05.07)

    DisplayObject3D: null
    DisplayObject3D: null
    3
    DisplayObject3D: rootNode
    TypeError: Error #1007: Instantiation attempted on a non-constructor.
    at com.myclasses::MyPaperVision3DTest/::init3D()
    at com.myclasses::MyPaperVision3DTest$iinit()
    at flash.display::Sprite/flash.display:Sprite::constructChildren()
    at flash.display::Sprite$iinit()
    at flash.display::MovieClip$iinit()
    at Test1_fla::MainTimeline$iinit()
    Constructor Called
    init3D() Called
    Papervision3D Beta RC1 (09.05.07)

    DisplayObject3D: null
    DisplayObject3D: null
    3
    DisplayObject3D: rootNode
    TypeError: Error #1007: Instantiation attempted on a non-constructor.
    at com.myclasses::MyPaperVision3DTest/::init3D()
    at com.myclasses::MyPaperVision3DTest$iinit()
    at Test1_fla::MainTimeline/Test1_fla::frame1()

    Any ideas????

  11. Ninja says:

    Hi I got this error when trying to compile the movie in Flash CS3… anyone have an idea? thanks!

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at Papervision3DTutorial2/::loop3D()

  12. Ninja,
    This error means that either “scene” and/or “rootNode” is null. It looks like something is going wrong with the initialization of these objects. You could remove the [Embed] tags (can’t use them in the Flash IDE) and replace them with assets from your library (check the PV3D documentation).
    Let me know if that helps!
    Dennis

  13. Bram Joris says:

    regarding the error in the flash IDE: import the png into flash, set the linkage id to cubetexture for example and use assetMaterial in stead of new BitmapMaterial

    var myMaterial :BitmapAssetMaterial = new BitmapAssetMaterial( “” );
    rootNode.addChild( new Cube( cubetexture, 200, 200, 200, 8, 8, 8 ), “myCube01″ );

  14. Hi Bram,
    Thanks for your comment. It’s a detail that I forgot because I do most of the coding with Flex or FlashDevelop :-)
    I’ll put it in the tutorial.
    Dennis

  15. Hi,
    this is really a good starting point for PV3D. I was looking for a tutorial that should only deal with the code, and this is it.Without Flash IDE the creation of 3D and the way 3D Objects are created one by one gives the foundation to start experimenting with.
    thank you for all your hard work.

  16. Great tutorials!! However, having a problem adding the cube using mxmlc.exe command line…

    Papervision3DTutorial2.as(66): col: 53 Error: Implicit coercion of a value of type org.papervision3d.materials:MaterialsList to an unrelated type org.papervision3d.core.proto:MaterialObject3D.

    Help!?
    jA

  17. Jihoon says:

    You need to change the code as follows:
    rootNode.addChild( new Cube( cubeMaterials.getMaterialByName(“all”), 200, 200, 200, 8, 8, 8 ), “myCube01″ );

  18. Hey, this is a kick butt tutorial. Keep them coming. Thanks a lot.

    I am using Flex 2.01. I followed the instructions to the letter, and when that didn’t work. I came to the comments and managed to solved the issue I was having with the materials. Only one small problem. Everything compiles, and starts the SWF but I am not able to see anything on the screen just a black screen. HELP! Thanks.

  19. Hey, this is a kick butt tutorial. Keep them coming. Thanks a lot.

    I am using Flex 2.01. I followed the instructions to the letter, and when that didn’t work. I came to the comments and managed to solved the issue I was having with the materials. Only one small problem. Everything compiles, and starts the SWF but I am not able to see anything on the screen just a black screen. HELP! Thanks.

  20. When pasting the full code post you get these errors in CS3
    Line 66 and 71
    1067: Implicit coercion of a value of type org.papervision3d.materials:MaterialsList to an unrelated type org.papervision3d.core.proto:MaterialObject3D.

    Problem corrects as follows:

    rootNode.addChild( new Cube( cubeMaterials.getMaterialByName(“all”), 200, 200, 200, 8, 8, 8 ), “myCube01″ );

    var myCube02:DisplayObject3D = rootNode.addChild( new Cube( cube2Materials.getMaterialByName(“all”), 200, 200, 200, 8, 8, 8 ), “myCube02″ );

  21. Pellumb says:

    I have a question …
    I know AS but i am not a professional … I would like to make a web page with papervision3d like http://www.truthinengineering.com with some squares flying and they move as user moves the mouse,and can these squares be just like normal Movie Clip so i can put an onRollOver and onRollOut animation .

    I am sure its not so hard to make it but i cant figure out how … If somebady can help , i would be very happy

  22. hello guys, dennis txs for the tut, i’m just starting with papervision and it still looks a little complicated but i’ll get used to it..
    anyway, the tut 1 is missing.. could you help?

  23. yukimi says:

    Hi, thanks for the tutorial. I’m a newbie in Papervision3d.

    When I tried out the tutorial (I’m using Flash, not Flex), I got these errors:

    Type was not found or was not a compile-time constant: MaterialsList. [var cubeMaterials:MaterialsList = new MaterialsList();]
    Incorrect number of arguments. Expected no more than 0. [scene = new Scene3D(container);]
    Call to a possibly undefined method MaterialsList. [var cubeMaterials:MaterialsList = new MaterialsList(); ]
    Call to a possibly undefined method Cube. [rootNode.addChild(new Cube(cubeMaterials, 200, 200, 200, 8, 8, 8), "myCube01");]
    Call to a possibly undefined method renderCamera through a reference with static type org.papervision3d.scenes:Scene3D. [scene.renderCamera(camera);]
    Definition org.papervision3d.objects:Cube could not be found. [import org.papervision3d.objects.Cube]
    Definition org.papervision3d.objects:MaterialsList could not be found. [import org.papervision3d.materials.MaterialsList]

    What’s wrong? Please advise.
    Thanks.

  24. Pradip Jadhav says:

    Hi, thanks for this great tutorial.

    I tested your tutorial on my machine. Its working fine…….. :)

    Now i have a problem that you use

    [Embed(source="../assets/cubetexture.png")] private var CubeTexture:Class;

    to apply background to texture cube..

    I want to change this background on image click event. So that i can change background dynamically…

    So is that possible to change background image dynamically……

    I really trying to this since last 4 days but i am not getting solution for this :’(

    Will you please help me to solve this……?

    Thanks in advance….:)

    Regards,
    Pradip Jadhav

  25. DJN says:

    Can you bring back the first tutorial? The link here and on a page that lists both papervision tutorials doesn’t work.

  26. deepzie says:

    How to show a tilted cube as and when you export it.. i mean to say i have a image mapped onto the top part of de cube which should be visible when it rotates on its x axis?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>