Power IK C++ SDK

The Power IK C++ SDK allows animation engineers to integrate Power IK into any animation software that can link C++ and uses skeletal animation.

This includes, but is not limited to:

  • game engines
  • VR training software
  • content creation software
  • industrial simulations
  • robotics

Power IK is commercially licensed priorietary software. To enquire about licensing our SDK, please contact support@poweranimated.com.

Unreal Integration Example

The best example of how to integrate Power IK can be found right in the default Unreal Plugin. The sample FPowerIKCore class wraps the SDK and allows rapid integration of the solver into multiple Anim Graph nodes, and also into Unreal's Control Rig plugin.

See PowerIK_UnrealCore.h for the FPowerIKCore class definition. Clients looking to integrate PowerIK into their own systems should reference this class to observe the necessary parts required to interface with the Power IK solver core.

Using the Unreal Plugin With Source Code

To compile and package the Power IK Unreal Plugin from source code, please follow the directions in the Convert Unreal Plugin section of these docs. You can ignore the rest of this document.

Install the Source Code SDK

  1. Copy the entire SDK folder into a suitable location in the project directory.
  2. Add sdk/include to the project's headers
  3. Add sdk/src to the project's source
  4. Then include PowerIK.h into the project source file that will use PowerIK.

Initialization

PowerIK should be initialized in the following way:

  1. Instantiate a PowerIK::Solver() class.
  2. Call Solver.SetNumBones() to reserve space for the entire skeleton
  3. Call Solver.AddBone() for each bone in the skeleton
  4. Call Solver.SetRootBone() to specify the top bone (root of solver)
  5. Call Solver.AddEffector() for each effector (cannot add/remove effectors at runtime)

On the first call to Solve(), PowerIK will allocate the necessary memory to support the bones and effectors that were added with AddBone(). There are no heap allocations after this.

Update Overview

Once PowerIK is initialized, it is ready to start Solving.

At every tick in the simulation update loop:

  1. Give Power IK a new input pose.
  2. Update the effector settings (transforms, weights etc...).
  3. Call Solve() to generate a new pose.
  4. Copy the output pose out of the Solver and use it as desired

NOTE: The input pose does not necessarily have to change from frame to frame. PowerIK will work equally well with static poses or animation (and both are useful in different scenarios).

Update Details

The update process should look like this:

  1. Call Solver.SetBoneTransform() for all bones to provide the input pose (the animation)
  2. Call Solver.SetEffectorTransform() for each effector to set their positions and rotations
  3. Call Solver.Solve() to run Power IK
  4. Call Solver.GetBoneTransform() to get the output pose

See AnimNode_PowerIK::CopySolverInputs() and AnimNode_PowerIK::CopySolverOutputs() for examples of how to do these steps in Unreal.

Note on Transform Spaces: All transforms (input/ouput on both bones and effectors) are considered to be in Character Space (Component Space in Unreal nomenclature). This space usually has it's origin at the character's feet or root bone. PowerIK solves in this space, so it is most efficient to avoid conversion to/from local/bone space or world space and simply keep all bones and effectors in Character Space.

Note on PowerIK Math Library: PowerIK uses it's own portable math library, so it is required to convert the positions and rotations to/from PowerIK::Vec3 and PowerIK::Quat format. These formats use plain 32-bit floats and should be convertable with any standard 3d-vector or quaternion format.

Shutdown and Reset

When the PowerIK::Solver() destructor is called, it releases all allocated memory.

In cases where it is desirable to add/remove characters using PowerIK often, it may be better to keep a pool of solvers in memory and recycle them. To avoid reallocating memory, consider calling PowerIK::Solver().Reset(). This will clear the internal memory (without releasing it) to be re-used with a different skeleton or different set of effectors. Bones and Effectors must be re-added after calling Reset().

Treat a Reset() solver like a newly instantiated Solver(). If the new skeletons have more bones than before Reset(), additional allocations may occur.

Once the Bones and Effectors are added, and Solve() has been called at least once, Power IK will never allocate more memory when calling Solve().