question

Choi Hyun Woong avatar image
0 Likes"
Choi Hyun Woong asked Choi Hyun Woong edited

How to use TASKTYPE_STARTANIMATION

As always, thank you for your support!

I am trying to assign a task with a loading animation to a TaskExcuter through the TaskSequence.addTask() method.

Also, TaskExcuter has custom animation applied through Animation Creator.

I want to load the items after the TaskExcuter moves to the destination (10,0,0) and performs a custom animation.


TaskSequence ts = TaskSequence.create(Model.find("TaskExcuter1"), 0, 0);

ts.addTask(TASKTYPE_TRAVELTOLOC, NULL, NULL, 10, 0 , 0);

ts.addTask(TASKTYPE_STARTANIMATION, NULL, NULL, 1);

ts.addTask(TASKTYPE_LOAD, item, station, 1);

ts.dispatch();


When you run the code above, the TaskExcuter moves to the destination (10,0,0), starts the custom animation, and loads the item even though the animation has not ended.


Additionally, please check the durationtype parameter and durationtvalue parameter, which are the arguments of TASKTYPE_STARTANIMATION.

FlexSim 24.1.0
tasksequencestasktype
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
0 Likes"
Felix Möhlmann answered Choi Hyun Woong edited

The task only starts the animation. It is finished in an instant. If you want to wait until the animation has finished, add a delay task with time equal to the animation duration to the task sequence.

For more information about the speed and duration parameters see the documentation on the Animation class.

https://docs.flexsim.com/en/24.0/Reference/CodingInFlexSim/FlexScriptAPIReference/Data/Animation.html#Method-start

· 5
5 |100000

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