Head Tracker
- Adds in a more advanced head tracker that uses bone array to get the exact position of head - Currently the circle changes size based on distance from player as the radius is set to a constant 5, this needs to be based off distance
This commit is contained in:
@@ -3,6 +3,17 @@
|
||||
|
||||
namespace render
|
||||
{
|
||||
void DrawCircle(HDC hdc, int x, int y, int radius, COLORREF color)
|
||||
{
|
||||
HBRUSH hBrush = CreateSolidBrush(color);
|
||||
HBRUSH hOldBrush = (HBRUSH)SelectObject(hdc, hBrush);
|
||||
|
||||
Ellipse(hdc, x - radius, y - radius, x + radius, y + radius);
|
||||
|
||||
SelectObject(hdc, hOldBrush);
|
||||
DeleteObject(hBrush);
|
||||
}
|
||||
|
||||
void DrawBorderBox(HDC hdc, int x, int y, int w, int h, COLORREF borderColor)
|
||||
{
|
||||
HBRUSH hBorderBrush = CreateSolidBrush(borderColor);
|
||||
|
||||
@@ -125,24 +125,40 @@ namespace hack {
|
||||
const Vector3 origin = process->read<Vector3>(pCSPlayerPawn + updater::offsets::m_vecOrigin);
|
||||
const Vector3 head = { origin.x, origin.y, origin.z + 75.f };
|
||||
|
||||
if (origin.x == localOrigin.x && origin.y == localOrigin.y && origin.z == localOrigin.z)
|
||||
continue;
|
||||
|
||||
const uintptr_t gamescene = process->read<uint64_t>(pCSPlayerPawn + 0x310);
|
||||
const uintptr_t bonearray = process->read<uint64_t>(gamescene + 0x160 + 0x80);
|
||||
const Vector3 headPos = process->read<Vector3>(bonearray + 6 * 32);
|
||||
|
||||
if (config::render_distance != -1 && (localOrigin - origin).length2d() > config::render_distance)
|
||||
continue;
|
||||
|
||||
if (origin.x == 0 && origin.y == 0 && origin.z == 0)
|
||||
if (origin.x == 0 && origin.y == 0)
|
||||
continue;
|
||||
|
||||
const Vector3 screenPos = origin.world_to_screen(view_matrix);
|
||||
const Vector3 screenHead = head.world_to_screen(view_matrix);
|
||||
const Vector3 screenHeadPos = headPos.world_to_screen(view_matrix);
|
||||
|
||||
if (screenPos.z >= 0.01f) {
|
||||
const float height = screenPos.y - screenHead.y;
|
||||
const float width = height / 2.4f;
|
||||
const float head_height = (screenPos.y - screenHead.y) / 8;
|
||||
const float head_width = (height / 2.4f) / 4;
|
||||
const float head_height = (screenHeadPos.y - screenHeadPos.y) / 8;
|
||||
const float head_width = (head_height / 2.4f) / 4;
|
||||
|
||||
float distance = localOrigin.calculate_distance(origin);
|
||||
int roundedDistance = std::round(distance / 10.f);
|
||||
|
||||
render::DrawCircle(
|
||||
g::hdcBuffer,
|
||||
screenHeadPos.x,
|
||||
screenHeadPos.y,
|
||||
5,
|
||||
config::esp_box_color_enemy
|
||||
);
|
||||
|
||||
render::DrawBorderBox(
|
||||
g::hdcBuffer,
|
||||
screenHead.x - width / 2,
|
||||
@@ -296,7 +312,7 @@ namespace hack {
|
||||
}
|
||||
}
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user