MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / GetBonePos

Method GetBonePos

CrySystem/ScriptObjectEntity.cpp:3372–3407  ·  view source on GitHub ↗

! Retrieves the position of a bone @param bone Name of the helper object in the model @return Three component vector cotaining the position */

Source from the content-addressed store, hash-verified

3370 @return Three component vector cotaining the position
3371*/
3372int CScriptObjectEntity::GetBonePos(IFunctionHandler *pH)
3373{
3374 CHECK_PARAMETERS(1);
3375 const char * sBoneName = "wt";
3376 pH->GetParam(1,sBoneName);
3377
3378 IEntityCharacter *pIChar = m_pEntity->GetCharInterface();
3379 ICryCharInstance * cmodel = pIChar->GetCharacter(0);
3380
3381 if (!cmodel)
3382 return pH->EndFunctionNull();
3383
3384 ICryBone * pBone = cmodel->GetBoneByName(sBoneName);
3385 if(!pBone)
3386 {
3387 m_pISystem->GetILog()->Log("ERROR: CScriptObjectWeapon::GetBonePos: Bone not found: %s", sBoneName);
3388 return pH->EndFunctionNull();
3389 }
3390
3391 Vec3 vBonePos = pBone->GetBonePosition();
3392 Vec3 angles = m_pEntity->GetAngles();
3393
3394 // transform into entity space
3395 //Matrix44 m;
3396 //m.Identity();
3397 //m = GetTranslationMat(m_pEntity->GetPos())*m;
3398 //m = GetRotationZYX44(-angles*gf_DEGTORAD)*m; //NOTE: angles in radians and negated
3399
3400 //OPTIMISED_BY_IVO
3401 Matrix44 m=Matrix34::CreateRotationXYZ( Deg2Rad(angles),m_pEntity->GetPos());
3402 m=GetTransposed44(m); //TODO: remove this after E3 and use Matrix34 instead of Matrix44
3403
3404 SetMemberVector( SOE_MEMBER_BONE_POS,m.TransformPointOLD(vBonePos) );
3405 //Vec3 tmp = m.TransformPoint(vBonePos);
3406 return pH->EndFunction( m_memberSO[SOE_MEMBER_BONE_POS] );
3407}
3408
3409
3410/*! Retrieves the world direction of a bone - direction of Y axis of the bone

Callers

nothing calls this directly

Calls 13

Deg2RadFunction · 0.85
GetCharInterfaceMethod · 0.80
EndFunctionNullMethod · 0.80
GetILogMethod · 0.80
TransformPointOLDMethod · 0.80
EndFunctionMethod · 0.80
GetParamMethod · 0.45
GetCharacterMethod · 0.45
GetBoneByNameMethod · 0.45
LogMethod · 0.45
GetBonePositionMethod · 0.45
GetAnglesMethod · 0.45

Tested by

no test coverage detected