Roll up animation with armature

Hello everybody.

I’m trying to make a thin mattress (a simple parallelepiped with textures) roll up. The first try was with a curve path ( a spiral shape) linked to the mesh, animated and modelled in blender, but the result in babylon js didn’t preserve the deformation infos. The mattress was still, it didn’t move except for a translation on the X axes, and inspecting the scene i could see the spiral in the meshes but not the information about the animation.

So i tried with armatures cause i read that it’s well supported in babylon js. With a simple curve animation of the bones the model’s behaviour was the same as in blender, so it was performing in a great way. But, when i elaborated the bones structure to simulate the roll up, doing a spiral, the model was fine in blender but in babylon js it started behaving in a messed up way.

My question is, is that an impossible type of armature animation to achieve cause it’s not what a bone structure is supposed to do, or am i missing some exporting setting/modelling steps?

In alternative, as far as you know, is there a way to achieve that kind of animation?

Thank you so much for the eventual support, have a great day!


Could you kindly put your example into the Playground? It would much more easier to find the right answer to your question.
How to use your own 3D models in the Playground - Using External Assets - Babylon.js Documentation

Sure, sorry it’s my first thread in Babylon js.
Here it is,

1 Like

Using glTF, you are probably on your own. The people here who use glTF, coming from Blender at least, are not that familiar with animation.

For JSON / .babylon, things are exported by action. Even though I wrote that exporter, simple curve animation of the bones does not mean much to me. While this exporter, actually runs the animation frame by frame when exporting, glTF might not. You might want to bake it.

Also, I do not remember how to do it, but you can get bones to be visible in BJS. This might make things more apparent.

1 Like

Thank you for your response.
With ‘simple curve animation of the bones’ i meant that when i did my first experiment with the bones, i made a basic rotation of them to see if the distortion was supported. The model’s animation in the babylon js was seen in the same way as i saw it on blender, so it was correct. Here is my first bone anim.

But when i animated the skeleton to make the mesh follow a ‘spiral’ shape the result was the scary playground i sent before.

Should i try export the model in a .babylon format?

Having 2 different ways to do things is a powerful way to flush out problems. The one thing I would not do is try to use the root bone, or multiple bones without a parent.

I added a skeleton viewer to your scene, It is the white line you see. You need to rotate the scene.

You have 15 bones, but you are not actually rotating the bones, unless I am not using the viewer right You might post a .blend file. I do not have the time to look at it though. Maybe @gryff

1 Like

BTW, if you do try the JSON / .babylon exporter, you need to start skeleton actions yourself, like

BABYLON.SceneLoader.Append(url, "myfile.babylon", scene);
        scene.executeWhenReady(function () {
            skeleton = scene.getSkeletonByName("base_male1");
            skeleton.beginAnimation("run", true);
           // Attach camera to canvas inputs

            // Once the scene is loaded, register a render loop
            engine.runRenderLoop(function() {
1 Like