def create_joints(self):
stack = ['<STR_LIT:root>']<EOL>while stack:<EOL><INDENT>parent = stack.pop()<EOL>for child in self.hierarchy.get(parent, ()):<EOL><INDENT>stack.append(child)<EOL><DEDENT>if parent not in self.bones:<EOL><INDENT>continue<EOL><DEDENT>bone = self.bones[parent]<EOL>body = [b for b in self.bodies if b.name == parent][<NUM_LIT:0>]<EOL>for child in self.hierarchy.get(parent, ()):<EOL><INDENT>child_bone = self.bones[child]<EOL>child_body = [b for b in self.bodies if b.name == child][<NUM_LIT:0>]<EOL>shape = ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>')[len(child_bone.dof)]<EOL>self.joints.append(self.world.join(shape, body, child_body))<EOL><DEDENT><DEDENT>
Traverse the bone hierarchy and create physics joints.