Mesh with animation loads at last frame

Hi, I exported a mesh with animation from Blender to Babylon and works fine except for one thing, it loads the mesh at its last animation state (last frame).

How can I load the mesh with the animation at frame 0?

Thank you.

It should load it at first frame and start from there.

Can you share your mesh in the playground (here is a doc to know how to reference it: Using External Assets - Babylon.js Documentation)?

A- Post log file
B- Are we talking about Mesh position, rotation or scale animation?
C- If talking about armature, it is exported in the current pose. If there is an active action, then the current frame of of the active action wuld be the current pose. Pose your armature the way you wish it to exported. FYI, the rest position is also exported, but you need to set to it in JS.
D- If you have more than one action, the physical exported order of them is determined by Blender. there are also intentional gaps. You should start each animation by a named AnimationRange.
E- No changes will be done to the Blender 2.79 based exporter.

1 Like

Thank you both, my object is just a basic 3d cube that moves, rotates and grow (loc rot and scale) in one single animation from frame 0 to 80. When it loads in babylon, appears in frame no. 80

For mesh animation, the current state, that is the current frame of the active action is used as the exported value. Make sure values frame is set prior to export.

Looking at the Mesh code, it is a subclass of F_curve_animatable (like camera & light as well). When super’s constructor runs, it reads all the actions, but resets back to the current action / current frame afterwards. Then meshe’s constructor proceeds to record all values.

You still did not post log file. With a scene so simple, you might be able to post the actual export as well.

This is the content of the log:
Exporter version: 4.6.1, Blender version: 2.72 (sub 0)
========= Conversion from Blender to Babylon.js =========
Scene settings used:
selected layers only: false
flat shading entire scene: false
inline textures: false
texture directory: C:\xampp\htdocs\contenido\contenidos
Python World class constructor completed
WARNING: No active camera has been assigned, or is not in a currently selected Blender layer
processing begun of mesh: Cube_Cube.001
animation processing begun
processing action Cube_Cube.001Action: in[1 - 80], out[0 - 80]
processing begun of Standard material: Material.006
processing begun of Standard material: Material.002
processing begun of Standard material: Material.004
processing begun of Standard material: Material.003
processing begun of Standard material: Material.001
processing begun of Standard material: Material.005
processing begun of multimaterial: animacion02.Multimaterial#0
num positions : 24
num normals : 24
num uvs : 0
num uvs2 : 0
num colors : 0
num indices : 36
========= Writing of scene file started =========
========= Writing of scene file completed =========
========= end of processing =========
elapsed time: 0 min, 0.0205 secs

4.6.1 is very old. I am pretty sure a change was made in this area since then.

Understood, I’ll try with a newer version

While this looks like just a test, you have 6 materials, which means you will have 6 sub-meshes, which will result in 6 draw calls.

In the Blender 2.80 exporter, there is also an option to force baking of meshes which will result in a single material with a texture. Right next to it is the dimension size, & whether to create a PNG / Alpha, or JPG.

If you are just doing tests, you probably are better in the long run of ditching Blender 2.79.

Yes, youre right, I tried with newer versions of blender and babylon exporter and now works fine. Thank you JC.