question

Maíra A avatar image
0 Likes"
Maíra A asked Maíra A commented

How can i adapt the "walkloaded" animation for object type?

I have objects to load with differents dimensions, and i would like to adapt the "walkloaded" animation to each object, because some of them are flying. How can i do that using the same operator?

exemple_walk_loaded.fsm

FlexSim 19.1.2
flowitemanimationloadobjectwalkloaded
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Felix Möhlmann avatar image
2 Likes"
Felix Möhlmann answered Maíra A commented

I don't think you can adjust an existing animation "on the fly". You can however switch between different pre-made animations with a small workaround and some limitations.

I used this in version 20.1, so I can't guarantee that this will work in 19.1.

First, you create the different animations that you want to use. In your case it would probably be easiest to duplicate the "WalkLoaded" and edit the bone positions of the arms, so the hands end up closer together. Next to "Keyframes" click on "Bone Animations" icon and then select "Animate Bones Directly". You can now rotate the bones manually and add keyframes with new bone positions at any point during the animation. In your case, you probably only need to adjust the elbow position at the start of the animation.

After you are done editing the new animations, go through the default animations and add a keyframe with reset bone positions (Bone icon -> Reset Bone Positions) to the start of each one. Otherwise the altered positions might appear in other animations.

Note at which position in the list your new animations are listed, this will be used in the next step.

To have the operator use a different animation from the default one, you simply switch around the names of the animations, so that the animation you want to use is called "WalkLoaded".

This can be done with the following code:

Object operator = "Insert reference to operator here";
treenode Animation = operator.attrs.animationinfo.subnodes[2].subnodes[X];
Animation.name = "NewName";

"X" is the number of the animation whose name you change and synonymous with the list position.

First, you should always rename all animation variants back to their unique default name (for example "WalkLoaded" + the list position to prevent duplicate naming. Then, depending on the item type, you set the name of one of the animation to "WalkLoaded".

It is important that this is done before the operator picks up the item. The animation is loaded as soon as the item is picked and any subsequent change will only take effect when the animation is next loaded, so only when the next item is picked up.

I added one additional animation to your example model and switch between them depending on the item type. The custom hand positions are not really correct for the small box either but it's just a demonstration.

exemple-walk-loaded_1.fsm


· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Maíra A avatar image Maíra A commented ·

@Felix Möhlmann Thank you so much for your aswer, this is exclatly what i need!

0 Likes 0 ·