Cubism SDK‎ > ‎Frameworks‎ > ‎

Priority of the Motion

Summary

This is an explanation about the priority, the setting, and the usage of the motion.
There is no problem if you use only MotionQueueManager in the library concerning to play the motion.
In this case, you need to decide whether to play one motion during playing another one by yourself.

The L2DMotionManager class is used in the sample provided.
The basic usage is same, as it takes over MotionQueueManager in the library.
This class is added the notion of priority of the motion to MotionQueueManager.

Setting the priority of standard specification

 * Priority is 0 when no motion is playing.
 * Priority is 1 while idling the motion.
 * Priority is 2 while playing other motions.
 * Priority is 3 when you want to force to play it ignoring the priority.

Usage

Priority is used to apply below rules easily.
 *If no motion is playing (priority is 0) at the moment, start playing like idling motions (priority is 1).
 *When the motion is playing (priority is 2) for tapping and so on, restart if the present priority is less than 2.
 *You can set the priority not only for the motion playing but also for reserving the motion.
  Herewith, you can distinguish whether to play the requested motion or not when loading the data with different thread.

Samples of the start of idling the motion
//Waiting motion judgement
if( mainMotionManager.isFinished() ){
//Choose one from the waiting motions randomly to play if no motion playing
mainMotionManager.startMotion( motions[ randomNo ] , L2DMotionManager.PRIORITY_IDLE );
}

Sample of playing the motion when tapping etc.
if( mainMotionManager.getCurrentPriority() >= priority ){
//Do not play since there is a motion playing
return;
}

mainMotionManager.startMotion(motion,priority);//Start playing

Sample of reserving the motion
Set the priority of reservation if there occurs time difference when loading a file with a different thread.
if( mainMotionManager.getReservePriority() >= priority)
{
//Do not play since there is a reservation to play (preparing with different thread)
return;
}
if( mainMotionManager.getCurrentPriority() >= priority ){
//Do not play since there is a motion playing
return;
}
mainMotionManager.setReservePriority(priority);//Set the reservation of priority if the motion play is asynchronous

//Load the file
load();


...

//Start playing after the file loading is completed. Ignore the play request during this period.
mainMotionManager.startMotion(motion,priority);


Comments