MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / GetAvgIKChainPos

Method GetAvgIKChainPos

Source/Objects/riggedobject.cpp:3042–3056  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3040}
3041
3042vec3 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
3058mat4 RiggedObject::GetIKChainTransform(const std::string& target_name, int which) {
3059 SimpleIKBone& sib = skeleton_.simple_ik_bones[target_name];

Callers 1

UpdateMethod · 0.80

Calls 1

GetPositionMethod · 0.45

Tested by

no test coverage detected