This is my first thread in this forum, so…
Hello world
I used to develop with papervision, but recently swapped to away3d.
(3.6.0, flash CS4, player 10.3.181.34)
I am currently adapting the code of a small project for away3d, but I got mysterious issues with… bonesAnimator.
I bought the cookbook and the friendsofEd’s book, but i’m still answer-less. Nowhere on the Internet is clearly talking about that :
My .DAE is fine when static, but when i do :
bonesAnimator.play();
All is screwed up. The mesh goes 10 miles away and is scarily deformed.
I tried with the running mario, he’s screwed up too.
I copy/pasted the 2 books codes… my meshes are still deformed.
I spent 3 days trying to get the point, I edited my colladas with notepad, I tried everything, I am goodwilling, but away3d keeps rejecting me.
And I don’t know why.
Here’s my test code :
import away3d.animators.*;
import away3d.cameras.*;
import away3d.containers.*;
import away3d.core.utils.*;
import away3d.events.*;
import away3d.loaders.*;
import away3d.materials.*;
import flash.display.*;
import flash.events.*;
import flash.utils.*;
//engine variables
var camera:Camera3D;
var view:View3D;
var scene:Scene3D;
//objectvariables
var collada:Collada;
var loader:Loader3D;
var model1:ObjectContainer3D;
//animation varibles
var bonesAnimator:BonesAnimator;
var loaded:Boolean;
initEngine();
initObjects();
addEventListener(Event.ENTER_FRAME, monEnterFrame);
stage.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDown);
function initEngine():void
{
scene = new Scene3D();
camera = new Camera3D();
view = new View3D();
view.camera = camera;
view.scene = scene;
addChild(view);
}
function initObjects():void
{
//loader = Collada.load("assets/mario_testrun.dae", {scaling:10, material:material, mouseEnabled:false}) as Loader3D;
collada = new Collada();
loader = new Loader3D();
loader.loadGeometry("assets/anim_03.dae", collada);
loader.addEventListener(Loader3DEvent.LOAD_SUCCESS, onSuccess);
scene.addChild(loader);
}
function monEnterFrame(event:Event):void
{
//render scene
view.render();
if(loaded)
{
//bonesAnimator.update(getTimer()*2/1000);
}
}
function myKeyDown(e:KeyboardEvent):void
{
switch (e.keyCode) {
case 90:
camera.zoom += 0.2;
break;
case 83:
camera.zoom -= 0.2;
break;
case 68:
bonesAnimator.play();
break;
case 81:
bonesAnimator.stop();
break;
}
trace("zoom "+camera.zoom);
}
function onSuccess(event:Loader3DEvent):void
{
loaded = true;
model1 = loader.handle as ObjectContainer3D;
model1.scale(10);
model1.x += 30;
model1.y -= 20;
var colorMaterial:ColorMaterial = new ColorMaterial();
colorMaterial.color = 0xFFA500;
model1.material = colorMaterial;
scene.addChild(model1);
trace(model1);
bonesAnimator = model1.animationLibrary.getAnimation("default").animator as BonesAnimator;
bonesAnimator.loop = true;
//bonesAnimator.play();
}