Parenting mesh to bones in Blender throws off the mesh’s orientation after exporting to .babylon

I made a simple robot in Blender, created an armature and parented the meshes to the bones.
To parent, I selected the mesh in object mode, selected the armature, went into pose mode, selected the appropriate bone, pressed CTRL-P and selected the bone option. After watching several tutorials, and trying everything, it seems like this is the correct way to parent meshes to bones.

Here’s a link to the blender.

In pose mode, I can move the bones around and the meshes move correctly as expected.
When I export to a .babylon file, all the meshes go to the origin and lay flat like shown below. Animating the bones has no effect at all.

I’ve applied transforms and scales to the meshes.
Can anyone give me a little guidance on how to animate meshes in blender so they move properly in blender.
It works properly if I use Automatic Weights like people often do with character animations, but I plan on animating many rigid meshes of complex models in many scenes and it would be very laborious to fix everything with weigh painting and wouldn’t be practical. This robot is just a test piece to help get the work flow down.
I’ve put a lot of time into switching from 3DS Max to blender. Everything has gone really well. I really like the switch, but after all that time invested, I can’t seem to get animations from blender to Babylon. I’ve spent so much time trying to figure this out and would really appreciate some guidance.

BalylonJS uses vertex weights, so that method has no shortcut. If there is no armature modifier on the mesh & weights on the output file, it is not going to work.

Not everything in Blender is supported. If all your models have a one bone to one mesh relationship, you might in theory hack the exporter & set all the weights to that one bone & be 1. Not recommended.

Looks like gryff is also reply, he may know some short cut.

@PatH Sorry I’ve not been around earlier - been kind of busy driving people around. As @JCPalmer points out using your method you do not have an armature modifier on the meshes or any vertex groups(weight painting) for each mesh.

Take a look at your second image above. Left side no “Skeletons” listed in the tree structure, and Right side the selected mesh (green cylinder) - “Has Skeleton = no” So no animation.

As for a “shortcut”, the best I can suggest is to use the “Automatic Weights” procedure that will give you the armature and vertex groups then select each mesh and delete the vertex groups for bones you do not want associated with a particular mesh.

I have modified one of your files doing it that way - see attached file

robot.zip (136.9 KB)

It contains the blend and .babylon file.

It may take slightly longer - but remember, parenting a model bone by bone is not a quick process - but there is no weight painting to do.

cheers, gryff :slight_smile:

Thanks for looking at this and posting a solution. You guys are the best.
This robot is a simple test piece I am using to get my work flow down. I may have a couple of hundred parts in a more involved hierarchy and deleting all the unwanted vertex groups from automatic weights would be tedious. I’m going to try it out and see what I can do.

Exporting an animation of a “regular” parented model with no armature has issues that I haven’t been able to solve. That was my 3DS Max way of working.

Here’s a rendering of a typical machine I animate. You can see that there are a lot of parts to work with.
Pardon the image quality. I’m working on it.

Can you make a general suggestion on how to animate many objects and get them to export to babylon js properly? Am I looking at this the wrong way? Is what I am trying to do between blender and babylon not feasible? I really don’t want to go back to 3DS Max.

Thank you for all your help and input.

Pat

@PatH : well Pat, a “couple of hundred parts” is going to be a lot of bones for any viewing PC or mobile device. I think @JCPalmer recommends <than 30 (possibly <20) for mobile devices and I typically use <than 60 for PCs…

That said, one suggestion I can make, though no guarantee of success, is to build the rig in parts. So create one rig (say A) then another rig (say B) etc.then clean out the vertex groups as I suggest. ( not a great deal more tedious than doing it bone by bone as you have been trying if the number of bones is small).

Now the tricky part - merging the armatures. Never done this myself, but people do use it for adding legs to spiders and scorpions. Just make sure that all the bones have different names. Hopefully, the merging process has no impact on those cleaned out vertex groups list that you have cleaned out.

It is just a thought that you might want to investigate.

cheers, gryff :slight_smile:

gryff,

There’s a couple hundred parts, but there would only be a few bones. The machine I posted the rendering of lifts up a drum, inverts it and slews it over another machine to dump out the contents. There might be 50 parts that flip the drum over, but they would be parented to one bone. Typically, I would group the drum inverting parts together in 3DS Max and animate the inversion of the group. Then I would use the Babylon exporter in Max and it all worked fine. I’m trying to recreate that with blender. Here’s a video YouTube I have done this through Max and it worked well.