unreliablecode / CSharp-Unity-ESP-Framework
Қоғамдық
High-performance C# ESP framework for Unity — 3D bounding boxes, 2D collider calculation, Animator skeleton bone tracking, and distance-scaled name tags.
main
1 Жұлдыздар
0 Шанышқылар
0 Бақылаушылар
Жаңартылған 2 days ago
C#
100%
Код
Мәселелер
Сұрауларды тарту 0
Міндеттеме береді
Филиалдар
Тегтер
Шығарылымдар
Іздеу
Қатысушылар
Wiki
Түсініктер
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# C# Unity ESP & Bounding Box Visualization Framework
A high-performance C# framework demonstrating real-time in-game bounding box calculations, collider screen projections, Unity `Animator` skeleton bone rendering, and distance-scaled name tags using Unity's `OnGUI` and `Camera.WorldToScreenPoint`.
## Features
- **3D Bounding Box Calculation**: Projects the 8 corner vertices of world-space `Bounds` into screen space and renders 12 connected wireframe edges.
- **2D Screen-Aligned Box**: Computes tight 2D screen bounding rectangles derived from 3D collider extents.
- **Skeleton & Bone ESP**: Traverses `Animator.GetBoneTransform(HumanBodyBones)` to render a full anatomical humanoid skeleton.
- **Name & Distance Tags**: Renders formatted text labels and health bars scaled by camera distance.
- **Occlusion & Viewport Clipping**: Automatically culls entities positioned behind the active camera frustum (`Z > 0`).
## Mathematical Projection Pipeline
### 1. 3D Bounding Box
Given an entity bounding box with center $C = (c_x, c_y, c_z)$ and extents $E = (e_x, e_y, e_z)$, the 8 world-space corners are computed:
$$V_{i,j,k} = C + (\pm e_x, \pm e_y, \pm e_z)$$
Each vertex is transformed to screen space via `Camera.WorldToScreenPoint(V)` and inverted along the Y-axis for Unity GUI coordinates:
$$y_{gui} = \text{Screen.height} - y_{screen}$$
### 2. Bone Skeleton Graph
Humanoid bones are queried using `HumanBodyBones` and connected as line segments:
- **Head & Spine**: `Head` -> `Neck` -> `Chest` -> `Spine` -> `Hips`
- **Left Arm**: `Neck` -> `LeftShoulder` -> `LeftUpperArm` -> `LeftLowerArm` -> `LeftHand`
- **Right Arm**: `Neck` -> `RightShoulder` -> `RightUpperArm` -> `RightLowerArm` -> `RightHand`
- **Left Leg**: `Hips` -> `LeftUpperLeg` -> `LeftLowerLeg` -> `LeftFoot`
- **Right Leg**: `Hips` -> `RightUpperLeg` -> `RightLowerLeg` -> `RightFoot`
## Usage
Attach `ESPManager` to an active GameObject with camera reference:
```csharp
using UnityEngine;
using CSharpESP;
public class ExampleUsage : MonoBehaviour
{
private void Start()
{
ESPManager.Instance.EnableBox3D = true;
ESPManager.Instance.EnableBones = true;
ESPManager.Instance.EnableNameTags = true;
}
}
```
## Structure
```
src/
├── Drawing/
│ └── RenderHelper.cs # 2D line, box, string, and texture drawing primitives
├── Entities/
│ └── ESPTarget.cs # Target tracking component with collider/animator bindings
├── Renderers/
│ ├── BoneRenderer.cs # HumanBodyBones skeleton graph traversal & rendering
│ ├── Box2DRenderer.cs # Screen-aligned 2D rectangle & corner brackets
│ ├── Box3DRenderer.cs # 8-vertex 12-edge 3D wireframe bounding box
│ └── NameTagRenderer.cs # Distance-scaled text label & health bar
├── ESPManager.cs # Main MonoBehaviour dispatcher
└── MathUtils.cs # Coordinate projection & bounding math
```
## License
Released under the [MIT License](LICENSE).