Hey people!
I’m struggling for multiple days now with a .dae model and its bones-animation. I’ve tried code from multiple books, have searched all around the internet, and even tried the puma model from the book “the essential guide to 3D in flash”, but no animation gets visible whatsoever.
I have 2 models, a male and a female, that is loaded once you press one of the buttons of those sexes. (It’s an avatarcreater for kids, which will also be used in another flash - game) It gets loaded with the following code:
public function createModel(_model:int):void
{
removeObject();
var collada:Collada = new Collada();
loader3D = new Loader3D();
loader3D.addEventListener(Loader3DEvent.LOAD_ERROR, onLoadError);
loader3D.addEventListener(Loader3DEvent.LOAD_PROGRESS, onLoadProgress);
loader3D.addEventListener(Loader3DEvent.LOAD_SUCCESS, onLoadSuccess);
if(_model == model1)
{
loader3D.loadGeometry('../assets/Models/Female/modelGirl.DAE', collada);
scene.addChild(loader3D);
}
else if (_model == model2)
{
loader3D.loadGeometry('../assets/Models/Male/modelBoy.DAE', collada);
scene.addChild(loader3D);
}
}
the onLoadSucces shows the model, however, as mentioned before, no animation.
private function onLoadSuccess(event:Loader3DEvent):void
{
var model:ObjectContainer3D = loader3D.handle as ObjectContainer3D;
model.scale(70);
if(!MaleOrFemale)
{
//Female model with animation
model.yaw(180);
model.pitch(-90);
camera.lookAt(new Vector3D(model.x +270, model.y, model.z));
modelAnimator = model.animationLibrary.getAnimation("default").animator as BonesAnimator;
modelAnimator.play();
}else
{
//Malemodel without animation
camera.y = 200;
camera.lookAt(new Vector3D(model.x +270, model.y +250, model.z));
}
}
I’ve tried to play the animation in the onenterframe function, and I have tried to use modelAnimator.update(getTimer()/1000); with all kinds of numbers besides 1000. The debugger shows with this piece of code in the onenterframe that it is going through the frames, but nothing seems to be moving. Something like a yaw animation works though.
Soo conclusion: both models are loaded and displayed in the view (the female is a tryout for the animation), yaw animation works, but bonesanimation doesn’t. What is it that I am doing wrong? Same problem occurs if I swap the femalemodel for the puma model from the book, and I’m at the point of giving up (that’s why I’m asking for help).