Playing blender animations in babylon

Exported basic blender animation with default names to babylon, imports mesh fine and console.log sees the animation but the code below doesn’t play the animation.

BABYLON.SceneLoader.Append("/", “bot.babylon”, scene);

        scene.executeWhenReady(function(){
            var ski = scene.getSkeletonByName("Armature");
            console.log(ski)

           ski.beginAnimation("ArmatureAction", true);
            console.log(ski.beginAnimation("ArmatureAction", true));
        });

Not really enough information, other than you are starting the animation twice. an export log file would be a start.

what you mean not enough information that is the information, how you play the animation, why its not working?

BABYLON.SceneLoader.ImportMesh(
“him”, “scenes/Dude/”, “Dude.babylon”, scene, function (newMeshes, particleSystems, skeletons) {
var dude = newMeshes[0];
console.log(dude);
dude.rotation.y = Math.PI;
dude.position = new BABYLON.Vector3(0, 0, -80);
scene.beginAnimation(skeletons[0], 0, 100, true, 1.0);

// Import character hightpoly
BABYLON.SceneLoader.ImportMesh("", “http://www.babylon.actifgames.com/anim/”, “man.babylon”, scene, function (newMeshesPerso, particleSystems, skeletonsPerso) {

			skeletonsPerso[0].copyAnimationRange(BipWalk, "walk", true);
  			skeletonsPerso[0].beginAnimation("walk", true, 1.0);
			
		});

How im stuck on this all week bro that’s like 500 bucks right there, like damn I just want to fucking give up. I mean shit the animation is already there why is there no simple instructions on how to call it. Does it not attach the armature to the mesh if not why don’t it say nothin, it should be simple like im trying make money here and this shit is costing me cuz I can’t get shit done and then you wanna tell me you aint information well me neither lmao

Did you try to load your model to Sandbox and have a look at Animation tab?
Also, if you would create your example in Playground, it would be much easier to help.

Alright well I will try to post in playground, just noticed that if I use the scene loader.ImportMesh and not sceneLoader.Append console.log(skeletons[0]) returns null but if I use append it sees the animation. Saw on another post to apply rotation and scaling in blender but that didn’t change anything.

Alright so Idk why but all of a sudden it works now and i didn’t even change nothing lol
So just to recap for the guy rippin their hair out all you do is import the .babylon file created by blender

 BABYLON.SceneLoader.ImportMesh("Cube","", "bot.babylon", scene, function (newMeshes, particleSystems, Armature) {
            
           var dude = newMeshes[0];
           scene.beginAnimation(Armature[0], 0, 40, true, 1.0);
           
        })

Where cube is the mesh name from blender the next “” is the folder location next is the babylon file, then scene then the function which i guess somehow the sceneloader passes the variables to. Then you make variable set to the newMeshes and your animation should be automatically attached with the mesh automatically because of ImportMesh Function.
Now if that don’t work then it’s probably something in blender export so play around with that and check that animation is being loaded with console.log(Variable for skeleton) to see if it exists.
Now to tackle the next problem.

1 Like

I understand you were frustrated but there are countless reasons why something might not work. It could be a problem in blender, the action name may not be “ArmatureAction” or some other problem in your file. We do not see your project, only the snippet you provided, and honestly, we can’t understand much from that. There is a tutorial available here Use Bones and Skeletons - Babylon.js Documentation . Did you check that out?

Please make sure to check the corresponding documentation and to try things out before posting. If you are sure you have tried everything, please make sure to provide a problem which we can reproduce. A playground example would be amazing. Otherwise, besides from some obvious issues, we won’t be able to help. Oh, and welcome to Babylon!

2 Likes

Yeah it was a problem with something in blender so the export file was messed up I tried again and it worked but yeah I read all that and tried everything, not really a good time to try to explain lol but yeah next one gonna post all the files so yall can see what I see thank you