2y ago · Jun 14, 2024 4:30 PM
Following up on @GhostHunter_x's thread, here is how to project and draw clean 3D WorldToScreen ESP markers for Cursed Possessions (Ouija Board, Tarot Cards, Haunted Mirror, Voodoo Doll, Music Box, Summoning Circle, Monkey Paw):
Pro-Tip for Unity Cameras:
In Unity IL2CPP, read and or multiply them into a combined view-projection matrix for the WorldToScreen calculation!
CPP
struct ItemESPInfo {
Vector3 worldPos;
const char* itemName;
ImU32 color;
};
void DrawCursedPossessionsESP(const std::vector<ItemESPInfo>& items, const Matrix4x4& viewMatrix, int screenW, int screenH) {
ImDrawList* drawList = ImGui::GetBackgroundDrawList();
for (const auto& item : items) {
Vector2 screenPos;
if (WorldToScreen(item.worldPos, screenPos, viewMatrix, screenW, screenH)) {
// Draw circle marker
drawList->AddCircleFilled(ImVec2(screenPos.x, screenPos.y), 4.0f, item.color);
// Draw item label with background contrast
char label[128];
float distance = GetDistance(g_LocalPlayer.position, item.worldPos);
snprintf(label, sizeof(label), "%s [%.1fm]", item.itemName, distance);
ImVec2 textSize = ImGui::CalcTextSize(label);
ImVec2 textPos = ImVec2(screenPos.x - (textSize.x * 0.5f), screenPos.y - 18.0f);
drawList->AddRectFilled(ImVec2(textPos.x - 3, textPos.y - 2), ImVec2(textPos.x + textSize.x + 3, textPos.y + textSize.y + 2), IM_COL32(0, 0, 0, 160), 4.0f);
drawList->AddText(textPos, IM_COL32(255, 255, 255, 255), label);
}
}
}Pro-Tip for Unity Cameras:
In Unity IL2CPP, read
CPP
Camera.main.worldToCameraMatrix CPP
Camera.main.projectionMatrix
ParanormalDev | MelonLoader & ImGui Modding
The following users thanked ParanormalDev for this post: