Creating tasks (constraints)

Tasks are created by calling

IKPositionTask* IKSolver::addPositionTask(const char* bonename)


IKOrientationTask* IKSolver::addOrientationTask(const char* bonename);

The task targets will be initialised to global positions/orientations of the respective segments at the moment of adding the task. Here global is defined in respect to the space of the parent of the first bone used inside the solver (the root).

Example code:

FIK::IKPositionTask *mLeftHandTask, *mRightHandTask, *mLeftFootTask, *mRightFootTask; 
FIK::IKOrientationTask *mHeadTask;
mLeftHandTask = mSolver->addPositionTask( /*NAME OF LEFT_HAND BONE */ );
mRightHandTask = mSolver->addPositionTask( /*NAME OF RIGHT_HAND BONE */ );
mLeftFootTask= mSolver->addPositionTask( /*NAME OF LEFT_FOOT BONE */ );
mRightFootTask= mSolver->addPositionTask( /*NAME OF RIGHT_FOOT BONE */ );
mHeadTask = mSolver->addOrientationTask( /*NAME OF HEAD BONE */ );

One can dynamically configure the rig in run-time. For example in the code above, five tasks are used in the full-body solver. Additional tasks can be added at runtime. For example orientation, force, etc. Position tasks on toes in addition to heel help to orient the foot the right way. Alternatively one can use position and orientation task at the heel. The head can also be assigned a position task along with the orientation task, to avoid unnecessary tilt when satisfying orientation. Every bone can be assigned a position or an orientation task or both. Force tasks can be also assigned to any bone. All tasks have Enable and Disable states for all degrees of freedom or for individual degrees of freedom. In this way one can tune the rig dynamically.

The segments can be pre-set to use limits or animation targets if this is known in advance. This is done by traversing the segments and calling



Example code:


for(unsigned int i=0;igetSegmentbyHandle(i)->enableRetargeting(true);

This flag can be subsequently changed at any time.


 IKSolver::getSegment(const char* name) 

can be used to access individiual segments by name but this typically consumes more CPU time.