Исходник АИМ на турели (если - или)

Energy Reload
Забаненный
Статус
Оффлайн
Регистрация
20 Авг 2017
Сообщения
1,206
Реакции[?]
330
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
C++:
if (strstr(Name, "Turret"))
                {
                    if (strstr(Name, "MR_TurretFloor_ASR_Cart_Indoor_"))
                    {
                        if (GetBoneId(pEntity, BoneName::bone_disk) == -1)continue;
                        LocBonePos = GetBoneName(pEntity, BoneName::bone_disk);
                    }
                    else
                        if (strstr(Name, "Drone_MG"))
                        {
                            if (GetBoneId(pEntity, BoneName::weaponPos_law) == -1)continue;
                            LocBonePos = GetBoneName(pEntity, BoneName::weaponPos_law);
                        }
                        else
                            if (
                                strstr(Name, "TurretHunt_") ||
                                strstr(Name, "Turret_MG"))
                            {
                                if (GetBoneId(pEntity, BoneName::eye_right_bone) == -1)continue;
                                Vec3 St1 = GetBoneName(pEntity, BoneName::eye_right_bone);
                                Vec3 St2 = GetBoneName(pEntity, BoneName::eye_left_bone);
                                LocBonePos = (St1 + St2) * 0.5;
                                LocBonePos.z = LocBonePos.z - 0.1f;
                            }
                            else
                                if (strstr(Name, "TurretFloor_MG") ||
                                    strstr(Name, "TurretFloor_mg") ||
                                    strstr(Name, "TurretRail_mg") ||
                                    strstr(Name, "TurretRail_MG"))
                                {
                                    if (GetBoneId(pEntity, BoneName::bone_head_left_rockets) == -1)continue;
                                    LocBonePos = GetBoneName(pEntity, BoneName::bone_head_left_rockets);
                                }
                                else
                                    if (strstr(Name, "TurretFloor_ASR"))
                                    {
                                        if (GetBoneId(pEntity, BoneName::bone_head) == -1)continue;
                                        LocBonePos = GetBoneName(pEntity, BoneName::bone_head);
                                    }
                                    else
                                        if (strstr(Name, "HeavyTurret"))
                                        {
                                            if (GetBoneId(pEntity, BoneName::weapon_bone) == -1)continue;
                                            LocBonePos = GetBoneName(pEntity, BoneName::weapon_bone);
                                        }
                }


C++:
int GetBoneId(IEntity* pEnt, string BoneName)
{
    ICharacterInstance* GetCharacter = pEnt->GetCharacter();
    if (!GetCharacter)return ZERO;

    ISkeletonPose* m_pSkeleton = GetCharacter->GetISkeletonPose();
    if (!m_pSkeleton)return ZERO;

    return m_pSkeleton->GetJointIDByName(BoneName.c_str());
}

Vec3 GetBoneName(IEntity* pEnt, string BoneName)
{

    ICharacterInstance* GetCharacter = pEnt->GetCharacter();
    if (!GetCharacter)return ZERO;

    ISkeletonPose* m_pSkeleton = GetCharacter->GetISkeletonPose();
    if (!m_pSkeleton)return ZERO;

    if (GetBoneId(pEnt, BoneName) != -1)
    {
        Matrix34 HeadPos = pEnt->GetProjectedWorldBBox() * Matrix34(m_pSkeleton->GetAbsJointByID(GetBoneId(pEnt, BoneName)));
        return HeadPos.GetTranslation();
    }
    return ZERO;
}
Конечной позицией является LocBonePos
 
Сверху Снизу