Sorry if that question already was asked.
I have class that works in Away3d, but in Away3d Lite skeleton does not move any bone. Could you please help me resolve this.
I tryed attached collada file but got error “The filetype you are attempting to upload is not allowed.”
that file is from samples for book Essential 3d in Flash, it doesn’t have animation but declare bones.
public class Away3dLite extends Sprite
{
[Embed(source="assets/skeleton.png")]
private var SkeletonMaterial:Class;
//collada file for character
[Embed(source="assets/skeleton.dae",mimeType="application/octet-stream")]
private var Skeleton:Class;
// sceleton
private var _skeletonCollada : Collada;
private var _skeleton : ObjectContainer3D;
private var _skeletonMaterial:BitmapMaterial;
private var _left_arm : Bone;
private var _left_leg : Bone;
private var _right_arm : Bone;
private var _right_leg : Bone;
//engine variables
private var camera:Camera3D;
private var view:View3D;
private var scene:Scene3D;
public function Away3dLite(){
Debug.active = true;
init();
}
/**
* Global initialise function
*/
private function init():void{
initEngine();
initMaterials();
initObjects();
initListeners();
}
/**
* Initialise the engine
*/
private function initEngine():void{
scene = new Scene3D();
camera = new Camera3D();
view = new View3D();
view.camera = camera;
view.scene = scene;
addChild(view);
}
/**
* Initialise the materials
*/
private function initMaterials():void{
_skeletonMaterial = new BitmapMaterial(Cast.bitmap(SkeletonMaterial));
}
/**
* Initialise the scene objects
*/
private function initObjects():void{
_skeletonCollada = new Collada();
_skeletonCollada.scaling = 10;
_skeleton = _skeletonCollada.parseGeometry(Skeleton) as ObjectContainer3D;
_skeleton.materialLibrary.getMaterial("lambert1").material = _skeletonMaterial;
_left_arm = _skeleton.getBoneByName("arm_l");
_left_leg = _skeleton.getBoneByName("leg_l");
_right_arm = _skeleton.getBoneByName("arm_r");
_right_leg = _skeleton.getBoneByName("leg_r");
_skeleton.x = 100;
_skeleton.z = 100;
scene.addChild(_skeleton);
}
/**
* Initialise the listeners
*/
private function initListeners():void{
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
/**
* Navigation and render loop
*/
private function onEnterFrame(event:Event):void{
if (_skeleton) {
_left_arm.rotationZ = (stage.mouseY - stage.stageHeight/2) / 4;
_right_arm.rotationZ = -(stage.mouseY - stage.stageHeight/2) / 4;
_left_leg.rotationZ = (stage.mouseY - stage.stageHeight) / 6;
_right_leg.rotationZ = -(stage.mouseY - stage.stageHeight) / 6;
}
//render scene
view.render();
}
}
}
Thank you.