| 3040 | } |
| 3041 | |
| 3042 | vec3 RiggedObject::GetAvgIKChainPos(const std::string& target_name) { |
| 3043 | vec3 total; |
| 3044 | float total_num = 0.0f; |
| 3045 | SimpleIKBone& sib = skeleton_.simple_ik_bones[target_name]; |
| 3046 | int bone = sib.bone_id; |
| 3047 | for (int i = 0; i < sib.chain_length; ++i) { |
| 3048 | total += skeleton_.physics_bones[bone].bullet_object->GetPosition(); |
| 3049 | total_num += 1.0f; |
| 3050 | bone = skeleton_.parents[bone]; |
| 3051 | if (bone == -1) { |
| 3052 | break; |
| 3053 | } |
| 3054 | } |
| 3055 | return total / total_num; |
| 3056 | } |
| 3057 | |
| 3058 | mat4 RiggedObject::GetIKChainTransform(const std::string& target_name, int which) { |
| 3059 | SimpleIKBone& sib = skeleton_.simple_ik_bones[target_name]; |