using UnityEngine; using CSharpESP.Drawing; namespace CSharpESP.Renderers { public class Box3DRenderer { private static readonly int[,] s_Edges = new int[12, 2] { // Bottom rectangle { 0, 1 }, { 1, 2 }, { 2, 3 }, { 3, 0 }, // Top rectangle { 4, 5 }, { 5, 6 }, { 6, 7 }, { 7, 4 }, // Vertical pillars { 0, 4 }, { 1, 5 }, { 2, 6 }, { 3, 7 } }; public static void Render(Camera camera, Bounds bounds, Color color, float thickness = 1.2f) { Vector3[] worldVerts = MathUtils.GetBoundsVertices(bounds); Vector2[] screenVerts = new Vector2[8]; for (int i = 0; i < 8; i++) { if (!MathUtils.WorldToScreen(camera, worldVerts[i], out screenVerts[i])) { // Skip 3D wireframe if any corner is clipped behind camera return; } } // Draw all 12 bounding box edges for (int e = 0; e < 12; e++) { int idxA = s_Edges[e, 0]; int idxB = s_Edges[e, 1]; RenderHelper.DrawLine(screenVerts[idxA], screenVerts[idxB], color, thickness); } } } }