Chapter 2 Wrap Up, Videos, Demos, PDF, and Source

May 30, 2010


I’m wrapping up chapter 2 in this post and starting chapter 3. In addition to the code demos, videos, and source, I’ve included an old version PDF of Chapter 2 (not what is in the book)…but close enough. I’m very excited about Chapter 3. I’ve got much to show you.

Chapter 2 … wrap up videos.

Chapter Demos

Interactive Cube

Hello Plane

Orbit Example

Basic View Test

Container Pivot

Simple Particle Pivot

Sphere Pivot

Christmas Tree

Chapter 2

Old Version Chapter 2 PDF


All Examples Above


3D Color Code Calculator in Away3DLite

May 28, 2010

Color Code Calculator

I did this example to demonstrate how to interactively change the materials of a Collada file in Away3DLite. I build the model in Cinema4D and assigned bands and added colors to those bands. I looked up their names in the out putted Collada file and then assigned materials as requested form the Flash Builder ComboBox using change event methods.


Color Code Calculator

Color Code Calculator



Code Discussion

Here’s example code for the first ComboBox

private function changeEvt1(e:Event):void


myOne = e.currentTarget.selectedIndex;

modelResistor.materialLibrary.getMaterial(“ID18”).material = myMatArray[myOne];



Code for Calculator Ohms as discussed on the video.

private function calcMyOhms():void {

myOhms = (myOne*10 + myTwo)*Math.pow(10, multiplier[myThree]);

if (myOhms >= 1000000) {

myOhms /= 1000000;

myOutput.text = “Resistance = “ + String(myOhms) + ” MOhms, “ + tolerance[myFour];

} else {

if (myOhms >= 1000) {

myOhms /= 1000;

myOutput.text = “Resistance = “ + String(myOhms) + ” KOhms, “ + tolerance[myFour];

} else {

myOutput.text = “Resistance = “ + String(myOhms) + ” Ohms, “ + tolerance[myFour];


A similar 2D example was done on the web by Danny Goodman at


private function changeEvt1(e:Event):void {

myOne = e.currentTarget.selectedIndex;

modelResistor.materialLibrary.getMaterial(“ID18”).material = myMatArray[myOne];



private function changeEvt2(e:Event):void {

myTwo = e.currentTarget.selectedIndex;

modelResistor.materialLibrary.getMaterial(“ID8”).material = myMatArray[myTwo];



private function changeEvt3(e:Event):void {

myThree = e.currentTarget.selectedIndex;

modelResistor.materialLibrary.getMaterial(“ID23”).material = myMatArray[myThree];



private function changeEvt4(e:Event):void {

myFour = e.currentTarget.selectedIndex;

modelResistor.materialLibrary.getMaterial(“ID13”).material = myPerArray[myFour];



Creating a Shuriken in Cinema4D (four videos)

May 18, 2010

Creating a Shuriken

In this four part series you learn how to create a Shuriken (throwing star) in Cinema4D.

1. Shuriken in Cinema4D – Photoshop

2. Shuriken in Cinema4D – Array Modifier

3. Shuriken in Cinema4D – Booleans

4. Shuriken in Cinema4D – Applying Textures

Download Model

Humvee in Away3DLite (and PV3D) wheels and steering

May 18, 2010


In chapter 5 of my book, I discuss how to make a car’s wheels move forwards and backwards and steer. It is actually pretty easy to do in PV3D. But in Away3DLite it is not so obvious. So in the video below I discuss the difference and show you how to get wheel movement and steering working for both PV3D and Awa3DLite.


Driving a Humvee in Away3dLite

Try It Out

Driving a Humvee

Driving a Humvee in Away3DLite


To see the code click the link below:

Read the rest of this entry »

Using Booleans in Cinema4D

May 14, 2010


In the following two videos I show you how to use Booleans to build a small machine part and add textures to achieve a degree of realism.


Using Booleans in Cinema4D Part1

Using Booleans in Cinema4D Part2

Collada and Jiglib – how to get it working!

May 3, 2010


I’ve been working on a number of Collada Jiglib projects so I thought I’d put a few videos (and some code) out there so people can use the Collada format in PV3D or Away3d. In the tutorials:

Video1: I start with Cinema4D create a die export it as a Collada file.

Video2: I show you how to bring it into Away3d and show how to hook it up and control it in Jiglib.

Video3:  I show you how to bring the Collada file into PV3D, controlling it in PV3D is very similar to that of Away3d and I’ll be doing a ton of other videos on building PV3D games in the further. Enjoy!


The demo is similar to the one created by Yagiz Gurgul on Active Tuts but I’ve upgraded it to Flash 10 and I am using a Collada file for the Dice as opposed to the standard square primitives that Yagiz used. In addition, I’ve moved it over to Flash Builder design view which gives me a ton of components and faster design, but does slow the 3D a little.

Dice and Table

Dice and Table


Collada and Jiglib – Building Cinema4D Dice

Collada and Jiglib – Controlling in Away3d

Collada and Jiglib – Loading into PV3D

Stub Code for Controlling in Away3d (Complete Code Below)

Here is the stub code for bringing in the Collada file and controlling it in Away3d.

private function createmyDice():void {

//model1 = Collada.parse(Charmesh, {scaling:10, material:material, mouseEnabled:false});
collada = new Collada();
collada.scaling = 1.4;

//var carSkin:ObjectContainer3D = ObjectContainer3D(event.loader.handle);
model1 = collada.parseGeometry(MyDie) as ObjectContainer3D;
model1.materialLibrary.getMaterial(“ID3”).material = material4;
model1.materialLibrary.getMaterial(“ID8”).material = material2;
model1.materialLibrary.getMaterial(“ID13”).material = material3;
model1.materialLibrary.getMaterial(“ID18”).material = material1;
model1.materialLibrary.getMaterial(“ID23”).material = material5;
model1.materialLibrary.getMaterial(“ID28”).material = material6;

dieBody= new JBox(new Away3dMesh(model1), 28, 28, 28);

//model1.mouseEnabled = true;

Stub Code for Importing into PV3D

Here is the stub code for bring the Collada file into PV3D. Controlling it is very similar to Away3d and you will be covering this in more detail in upcoming videos.

public function initCube() : void

// autoplay, name, loop animation
myCubeIs = new DAE(false,null,true);
myCubeIs.addEventListener( FileLoadEvent.LOAD_COMPLETE ,onmyLoad );
myCubeIs.load( ‘die.dae’ );
myCubeIs.scale = 10;
myCubeIs.z = 300;
myCubeIs.x = -100;
myCubeIs.y = 300;
myCubeIs.rotationY = -90;


Full Source

To see the complete source for the Away3d version click the link below:

Read the rest of this entry »