Начинающий
- Статус
- Оффлайн
- Регистрация
- 16 Сен 2024
- Сообщения
- 44
- Реакции
- 5
когда типы на базе и идут куда то, кость правой или какой то ноги коннектится к полу и тянется огромная полоса но если игрок близко то все пропадает
C++:
enum class BoneId
{
WAIS = 0,
NECK = 5,
HEAD = 6,
SHOULDERLEFT = 8,
FORELEFT = 9,
HANDLEFT = 11,
SHOULDERIGHT = 13,
FORERIGHT = 14,
HANDRIGHT = 16,
KNEELEFT = 23,
FEETLEFT = 24,
KNEERIGHT = 26,
FEETRIGHT = 27
};
std::vector<vector3> read_bones(uintptr_t scene_node)
{
std::vector<vector3> bones;
if (!scene_node) return bones;
uintptr_t bone_matrix = *reinterpret_cast<uintptr_t*>(scene_node + offsets::model_state + 0x80);
if (!bone_matrix) return bones;
uint8_t bone_data[28 * 32];
if (!ReadProcessMemory(GetCurrentProcess(), (LPCVOID)bone_matrix, bone_data, sizeof(bone_data), nullptr)) return bones;
int bone_indices[] = { 0, 5, 6, 8, 9, 11, 13, 14, 16, 23, 24, 26, 27 };
for (int id : bone_indices)
{
float x = *reinterpret_cast<float*>(bone_data + id * 32 + 0);
float y = *reinterpret_cast<float*>(bone_data + id * 32 + 4);
float z = *reinterpret_cast<float*>(bone_data + id * 32 + 8);
if (std::isfinite(x) && std::isfinite(y) && std::isfinite(z))
bones.push_back(vector3(x, y, z));
else
bones.push_back(vector3(0, 0, 0));
}
return bones;
}
std::vector<vector2> bones_to_2d(const std::vector<vector3>& bones, float (*view_matrix)[4][4])
{
std::vector<vector2> bones_2d;
for (const auto& bone : bones)
{
vector2 screen_pos;
if (bone.wts(screen_pos, view_matrix) && screen_pos.x > 0 && screen_pos.x < screen_width && screen_pos.y > 0 && screen_pos.y < screen_height)
{
bones_2d.push_back(screen_pos);
}
else
{
bones_2d.push_back(vector2(-99, -99));
}
}
return bones_2d;
}
void draw_skeleton(const entities::entity& entity, ImDrawList* draw_list, const vector3& local_pos, bool is_teammate)
{
if (is_teammate && !render::teammate_enable_skeleton) return;
if (!is_teammate && !render::enemy_enable_skeleton) return;
uintptr_t scene_node = *reinterpret_cast<uintptr_t*>(entity.base + offsets::scene_node);
if (!scene_node) return;
auto bones = read_bones(scene_node);
if (bones.size() < 13) return;
float (*view_matrix)[4][4] = reinterpret_cast<float(*)[4][4]>(entities::client + offsets::view_matrix);
if (!view_matrix) return;
auto bones_2d = bones_to_2d(bones, view_matrix);
if (bones_2d.size() < 13) return;
bool is_scoped = *reinterpret_cast<bool*>(entity.base + offsets::m_bIsScoped);
float thickness = is_scoped ? 2.0f : 1.0f;
ImU32 color = is_teammate ?
ImGui::ColorConvertFloat4ToU32(ImVec4(render::teammate_skeleton_color[0], render::teammate_skeleton_color[1], render::teammate_skeleton_color[2], render::teammate_skeleton_color[3])) :
ImGui::ColorConvertFloat4ToU32(ImVec4(render::enemy_skeleton_color[0], render::enemy_skeleton_color[1], render::enemy_skeleton_color[2], render::enemy_skeleton_color[3]));
auto draw_bone_line = [&](int from, int to)
{
if (bones_2d[from].x > 0 && bones_2d[from].y > 0 && bones_2d[to].x > 0 && bones_2d[to].y > 0)
{
draw_list->AddLine(ImVec2(bones_2d[from].x, bones_2d[from].y), ImVec2(bones_2d[to].x, bones_2d[to].y), color, thickness);
}
};
draw_bone_line(1, 2);
draw_bone_line(1, 3);
draw_bone_line(1, 6);
draw_bone_line(3, 4);
draw_bone_line(6, 7);
draw_bone_line(4, 5);
draw_bone_line(7, 8);
draw_bone_line(1, 0);
draw_bone_line(0, 9);
draw_bone_line(0, 11);
draw_bone_line(9, 10);
draw_bone_line(11, 12);
if (bones_2d[2].x > 0 && bones_2d[2].y > 0)
{
float height = entity.feet_pos.y - entity.head_pos.y;
float radius = height / 8.5f;
draw_list->AddCircle(ImVec2(bones_2d[2].x, bones_2d[2].y), radius, color, 0, thickness);
}
}
Последнее редактирование: