Exporting animations from Blender to a .babylon file. Objects not where expected

I’m not sure if this should be posted in https://forum.babylonjs.com/ or https://www.html5gamedevs.com/ so I’m posting on both.

I have seen several posts and solutions to similar questions with the blender to babylon exporter (exporter V6.2.0, blender version 2.8)

I’ve exported many animations from 3DS Max, but I’m fairly new to blender.

I’m studying the Action editor, but obviously I’m not understanding something very fundamental.

Basically, the issue is that the position of objects is different between the animation in blender and the .babylon

I’ve read that you need to check “Only Currently Assigned Actions” or put a hyphen in the Action name.

Autolaunch animations for each object.

Apply transforms to each object. Set the location to where the object should be rotated about.

Parent the objects to each other. Don’t parent empties because you can set an empty to “Auto launch animations”

All these things have helped tremendously. I’m still missing or not understanding something though. I’ve done my homework, but haven’t figured it out. Any help would be greatly appreciated.

Here is the playground link showing the issue.


Here is a link to the .blend and .babylon files in dropbox

In the world tab, Only Currently Assigned Actions is checked.


Applied rotation and scale of parts. I set the location to where I want the part to rotate about.

I select the redCube (Axis 1). Frame 10 I insert a LRS key. redCubeAction is created in the action editor

Scrub to frame 40. rotate the redCube by -45 degrees on the x axis. and insert another key.

The animation runs in blender and the .babylon as expected. All is good so far.
I didn’t bake the animation. It doesn’t seem to make a difference.

I select the blue cube (axis3) which is parented to the redCube. Click on New in the action editor. “Action” is created. I scrub to 50 and make a LRS key with blueCube selected. I scrub to 80, rotate blueCube along the X axis by +45 degrees and make another key. The robot is kind of squat there. The blueCube is at the end of the Red cube as a good robot should be.

I play the animation in Blender and it runs as expected, but in the .babylon file, the blueCube is raised up a bit.

Does anyone know why this happens and what I can do to prevent it?

This would really be best done as an armature / skeleton. Then there would be a single animation, rather than one for each mesh.

On its face, the part of your log file with meshes that have animations looks right. (animation on your plane is probably a mistake):

	processing begun of mesh:  redCube
		animation processing begun
			processing action redCubeAction:  in[10 - 40], out[0 - 40]
		processing begun of material:  robotBlenderForForum.red
		num positions      :  120
		num normals        :  120
		num tangents       :  0
		num uvs            :  240
		num uvs2           :  0
		num colors         :  0
		num indices        :  156
	processing begun of mesh:  blueCube
		animation processing begun
			processing action Action:  in[50 - 80], out[0 - 80]
		processing begun of material:  robotBlenderForForum.blue
		num positions      :  126
		num normals        :  126
		num tangents       :  0
		num uvs            :  252
		num uvs2           :  0
		num colors         :  0
		num indices        :  156
	processing begun of mesh:  Plane
		animation processing begun
			processing action PlaneAction:  in[50 - 50], out[0 - 50]
		processing begun of material:  robotBlenderForForum.gray
		num positions      :  4
		num normals        :  4
		num tangents       :  0
		num uvs            :  8
		num uvs2           :  0
		num colors         :  0
		num indices        :  6

I am thinking the problem is your blue cube is parented to the red one. I manually deleted the parent_id of the blue cube in the .babylon in WordPad & ran again in sandbox. You should do so as well. Now the blue cube actually rotates down, but does not stay attached.

But notice that the 2 actions occur simultaneously. I copied and pasted the 50 frame at the 0 frame of the blue’s action. Now that part is fixed.

There is still the gap. Seems like this separate animations approach, where one causes a position change of another mesh running its own animation, is not going to work. This is why there are armatures. A 2 bone armature will do this. You might want to make sure the blue & red cubes share the same origin though. That is pretty easy in 2.80. Setting origin is in the right click menu.

Hi Pat - welcome to the forum :slight_smile:

I took a look at your blender file (camera right) and took some screenshots - images 1 and 2 below. I selected the “blue cube” and moved the animation slider to 0 and took a pic (image 1). I then moved the animation slider to 80 and took another pic (image 2).

NOTE: the position of the blue cube is not changing in terms of location - x, y, x values are the same - which as you can see in the pics is not true. Is this an issue with Blender? The Z value at 80 should be lower than at 0 ?? That might explain what you are seeing.

cheers, gryff :slight_smile:

Yes, I noticed that. I’ve been experimenting with local/global transforms and seem to get the same results.
I’m not sure what to do about it though.
Any thought?

So I tried using armatures. Sounds like a good idea.
Everything got squashed down to a plane for some reason.
I’ll keep trying, but I must have put in about 40 hours so far trying to get animations from blender to .babylon. It’s getting better, but still not usable. I’m going to keep trying with the armatures. This is tough…