# How to Set/Calculate pole angle of IK constraint so the chain does not move?

How to calculate the exact pole angle so when I add Pole bone the IK chain does not move?

## 1 Answer

This is what the pole angle is:

Its a signed angle between the Base_Bone's X axis and the projected Pole_axis onto Base_Bone's XZ plane. The direction of projection is IK_axis.

Fill in the bone names, it will print the appropriate pole angle into System console. Then you can set the IK constraint with that Pole bone and angle and the IK chain won't move:

import bpy
from mathutils import *

def signed_angle(vector_u, vector_v, normal):
# Normal specifies orientation
angle = vector_u.angle(vector_v)
if vector_u.cross(vector_v).angle(normal) < 1:
angle = -angle
return angle

def get_pole_angle(base_bone, ik_bone, pole_location):
pole_normal = (ik_bone.tail - base_bone.head).cross(pole_location - base_bone.head)
projected_pole_axis = pole_normal.cross(base_bone.tail - base_bone.head)
return signed_angle(base_bone.x_axis, projected_pole_axis, base_bone.tail - base_bone.head)

base_bone = bpy.context.active_object.pose.bones["BASE_BONE_NAME"]
ik_bone = bpy.context.active_object.pose.bones["IK_BONE_NAME"]
pole_bone = bpy.context.active_object.pose.bones["POLE_BONE_NAME"]

pole_angle_in_radians = get_pole_angle(base_bone,
ik_bone,
pole_bone.matrix.translation)
pole_angle_in_deg = round(180*pole_angle_in_radians/3.141592, 3)
print(pole_angle_in_deg)

• I have new respect for Maya. Its pole vector is flawless. I haven't given up in Blender though. I'll see if I can find a workaround – allen Jul 29 '15 at 17:25
• @allen I agree, Maya's rigging is much much superior than this. Except for advanced IK and some bone dependency cycles all can be replicated in blender though. But it's not that easy. – Jaroslav Jerryno Novotny Jul 30 '15 at 6:08
• Its extremely frustrating. I've spent a lot of time making quality rigs for Maya and I love fancy rigs. I was able to find enough great tutorials to create "Driven Keys" in Blender, foot roll and banking, ect. I wasn't far off from duplicating a production quality Maya rig in Blender. But the accuracy with respect to the bind pose is terrible! It's a shame since I love to rig. – allen Jul 30 '15 at 20:29
• Very useful information, no matter how old the post. Just bookmarked the page. Thank you. – Rita Geraghty stands by Monica Jan 28 '19 at 10:16
• for some reason the angle generated by this script didn't work for me, but it was still useful, I adjusted the pole angle manually and used the script to calculate how far it currently is from the perfect angle :) – Ahmed Ali Feb 14 '19 at 8:09