Nested Blend Trees

I’m trying to setup nested blend trees on an anim component, following this example from the original PR.

I’m getting some very strange results when logging the path of each nested child. I’ve setup a demo project here: PlayCanvas | HTML5 Game Engine

Everything looks normal when running a blendtree 1 level deep (2 layers total including the state):
Screenshot 2024-03-21 at 11.43.50 pm

When adding children on Level2 I get this:
Screenshot 2024-03-21 at 11.45.18 pm
It seems that Level2’s name is assigned as “Level1”, and it’s not part of the path property.

When adding children to Level3, it seems to break immediately. The first layers children is an array containing a single undefined.
Screenshot 2024-03-21 at 11.46.33 pm
Screenshot 2024-03-21 at 11.52.29 pm

Am I approaching this incorrectly or is this an outdated JSON structure for anim state graphs?

Apologies if this explanation is all over the place, hopefully the example project can shed some light.

Thanks

Engine examples all use only a single level depth trees: PlayCanvas Examples
So it’s possible these is a bug in multi-level somewhere.

So suffice to say nested blend trees are currently not supported?

I’m not super familiar with engine code, would this be something that’s relatively straightforward to fix?

They’re supported, but as it’s likely not commonly used, it might need some fixes in some cases and similar. Hard to say, but it seems you’ve found an issue already.

Not sure about the fix, as we don’t understand the reason here. It could be just a tiny fix and the rest works, or a larger refactoring might be needed.

1 Like

I’ve created a ticket. @BenBean303 would you like to submit a PR?

1 Like