Into
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!
Demo
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
Videos
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);
physics.addBody(dieBody);
//model1.mouseEnabled = true;
scene.addChild(model1);
myDices.push(dieBody);
}
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.addFileSearchPath(“assets/tex”);
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 »