Use of AnimationNames

Hi everyone!
I am struggling a little bit with Animation here.

The first argument when creating an animation is the name right?
What is the purpose of that?
When I start animation using Scene.beginAnimation() I call the object, no the animation I want to start.
I really would love to start animations by name, but I can not figure out how.
This would be really convenient when having multiple animation on one object.

Also in the Animation Blending Example Animations are retrieved from a skeleton by name.
Can I do that for mesh animations as well?
And how do i define those names in Blender?

Thank you so much in advance!
Best regards

Hey!

I have no idea for Blender but @JCPalmer or @Vinc3r may be able to help here.

Animation name is mostly for you to recognize them when for instance going through all animations on a mesh.animations array.

Scene.beginAnimation will start all animations on a a given entity (like all animations in mesh.animations).

you can use scene.beginDirectAnimations to start a specific group of animations (see in this chapter: Combine Animations - Babylon.js Documentation)

Another good option is to use AnimationGroup: Group Animations - Babylon.js Documentation

The Animation blending example use another concept which is animation range (where you give a name to a specific subset of a larger animation: Skeleton - Babylon.js Documentation

Check here: https://www.babylonjs-playground.com/#1BU28Z#2 (lines 34 and 35)

Blender exports AnimationRanges. Using beginAnimation:

skeleton = scene.getSkeletonByName("dude");
skeleton.beginAnimation("rangeName", true);

@JCPalmer but how do I set the name of the Range inside Unity?

I only know Blender. That is what your question referenced. Do not even know if unity exporter exports named ranges. Open up your .babylon file in a text editor and search for "ranges":[ If there are no hits, then no ranges.

1 Like

@JCPalmer
I am so sorry… I meant Blender of course. How can I set names in there?

Sorry, I am working on three things at the same time, and my mind mixed things up. So Sorry.

Actions are the Blender unit of animation exported. All the actions are exported as one animation strung together with frame gaps. The ranges are also recorded, so each action can be started by name without knowing where they are.

Actions are managed by the Dope Sheet form. Each action always has a name, whether you give it one or not. The names can be seen / changed when you put the form in Action Editor mode. All the actions are listed by name in a drop down or you can create one.

2 Likes

Fantastic!
Thank you so much!