Vec3 GetBonePositionByID ( IEntity * pIEntity , INT iBoneID ) { ICharacterInstance * pICharacterInstance = pIEntity -> GetCharacter ( 0 ) ; if ( ! pICharacterInstance ) return { ZERO } ; ISkeletonPose * pISkeletonPose = pICharacterInstance -> GetISkeletonPose ( ) ; if ( ! pISkeletonPose ) return { ZERO } ; Matrix34 mOut = pIEntity -> GetWorldTM ( ) * Matrix34 ( pISkeletonPose -> GetAbsJointByID ( iBoneID ) ) ; return mOut . GetTranslation ( ) ; }
IActor * m_pActor = NULL ; if ( IItem * m_pItem = m_pActor -> GetCurrentItem ( ) ) { if ( IWeapon * m_pWeapon = m_pItem -> GetIWeapon ( ) ) { Vec3 vHeadPosPVP = GetBonePositionByID ( m_pEntity , 13 ) ; // идеальная кость головы для пвп Vec3 vHeadPosPVE = GetBonePositionByID ( m_pEntity , 11 ) ; // идеальная кость головы для пве m_pWeapon -> SetFiringPos ( vHeadPosPVP ) ; } }