Initial setup

 Create solver using

m_Solver = new FIK::IKSolver(licensePath,&errorMessage);

A. Populate the solver using the ImportBone structure, for this:

  1. Create a list of ImportBones objects. These objects will be in the rest pose when the figure is loaded into the solver.
  2. m_Bones is an array (std::vector) holding the skeletal structure as loaded into the game engine.  
                std::vector skeletonData;
		for(std::size_t b=0;bm_Bones.size();b++)
		{
			Bone* boneDef = &m_Bones[i];
			FIK::ImportBone ikBone;
			ikBone.name = boneDef->m_Name.c_str();
			if(boneDef->m_ParentName.length())
				ikBone.parentname = boneDef->m_ParentName.c_str();
			else
				ikBone.parentname = 0;
			FIK::Vector v(boneDef->m_Trans[0],boneDef->m_Trans[1],boneDef->m_Trans[2]);
			ikBone.rest_offset[0] = v[0];
			ikBone.rest_offset[1] = v[1];
			ikBone.rest_offset[2] = v[2];
			FIK::Quaternion q(boneDef->m_Quat[0],boneDef->m_Quat[1],boneDef->m_Quat[2],boneDef->m_Quat[3]);


			//local orientation of the bone in the "bind pose", format: quaternion {w,x,y,z}
			ikBone.rest_orientation[0] = q[3];
			ikBone.rest_orientation[1] = q[0];
			ikBone.rest_orientation[2] = q[1];
			ikBone.rest_orientation[3] = q[2];


			skeletonData.push_back(ikBone);
		}

3. Call m_Solver->import to populate solver.

 m_Solver->importBones(&skeletonData[0], static_cast(skeletonData.size()));

B. Solver setup

Once the avatar is loaded to the solver, setup the sover's behavior 

  1. Set up the solver tuning options, solver iterations number, tolerance, various gains, rootTranslations and others
  2. Set up the per segment tuning, (i.e. limits values, limits gains, retargetting gaints, stiffness ..etc); Please note that the limits setup is optional and not needed in most cases and during retargeting.
  3. Create the rig by setting up the position and orientation constraints on the character.
                m_Pos = m_Solver->addPositionTask(“Segment Name”); //For Position Task
                m_Orient = m_Solver->addOrientationTask(“Segment Name”); //For Orientation Task

4. Set up the tuning parameters for the tasks/constraints on the rig