createInstance on a family of animated rabbits

Hi guys!
I want to make a family of wabbits that consist of 1 mama rabbit and a couple of children (children are different from mama in terms of size/pos/rots) . Then I want to merge them into 1 (aka rabbit_family), combine their skeletons (since they are identical) and assign to rabbit_family. I want to be able to create multiple instances of rabbit_family and run beginAnimation on source rabbit_family. I managed to get something on PG: https://playground.babylonjs.com/#QY1WYT#241
But since the skeletons are not combined, only mama skeleton is used on the final merged mesh, the animations are deformed for the children.

My question: Is this approach feasible or simply wishful thinking ? Or should I just live with creating instances for all instead of relying on merging ?

I’m far from an expert, but I’ve never heard of merging skeletons. If you create the asset yourself, you could create a group of entities that animate together. To do it with the default assets, I would honestly just instance each rabbit, clone a skeleton for each rabbit, run the animations on each skeleton, and then create an object that contains all of the rabbits in that family with any helper functions you need. It wouldn’t be terrible performance wise unless you’re needing a LOT of rabbit families.

1 Like

It does not work because the animation data are relative to the vertex positions of the mesh.

When you merge your rabbits, the two small rabbits have a scaling/position that are baked to the vertex data so that they have the right size/position in the merged mesh. But now the animation can’t apply correctly to them because of this (the scaling is not a problem in fact, it’s only the position).

Creating instances is more efficient as the geometry exists only once, so it’s the way to go.

1 Like

Thanks for all the helpful replies. Yh, I’m aware the pg wouldn’t work. I’m interested in the workflow of instanced animated clusters. This could be tackled using thin instances (just found the doc). Time to do some experimenting!

Whee! I got it: https://playground.babylonjs.com/#QY1WYT#243

Leaving it here for anyone who might need it as well. :slight_smile:

2 Likes