Supericy
11-23-2010, 06:52 PM
Ok, i am fairly new here and this is my first post i have made. I am working on external box ESP using the GDI library. Everything i have so far works fine, except i am having troubles converting angles to position on screen.
Current code, *SEMI* works for 1024x768, but the spot it draws box is still not 100% correct.
Local.GetPos();
Local.GetView();
for (int ESPID=1;ESPID <= 1;ESPID++)
{
Target.GetPos(ESPID);
angleX = _degree(atan(abs(Target.y-Local.y)/abs(Target.x-Local.x)));
if (Target.x < Local.x)
angleX+=180;
if ((Target.x > Local.x && Local.y > Target.y) || (Target.x < Local.x && Local.y < Target.y))
angleX = 360-angleX;
dist = sqrt((pow(Target.x-Local.x, 2)+pow(Target.y-Local.y, 2)+pow(Target.z-Local.z, 2)));
angleY = _degree(acos((Target.z-Local.z)/dist))-90;
xOFF = angleX-Local.yaw; //get angle from my crosshair
if (xOFF < -180)
xOFF+=360;
else if (xOFF > 180)
xOFF-=360;
yOFF = angleY-Local.pitch; //get angle from my crosshair
xPixel = xOFF/0.088;
yPixel = yOFF/0.099;
boxScale = (1024 * 64 / (dist * (2*tan(32.5)))); //get box size
DrawBox(HLDC, screencenter[0]-xPixel, screencenter[1]+yPixel, boxScale, boxScale*2, 0x00CD2626); //draw box
}
I was wondering if anyone could help me out, or give me some hints into the right direction.
Current code, *SEMI* works for 1024x768, but the spot it draws box is still not 100% correct.
Local.GetPos();
Local.GetView();
for (int ESPID=1;ESPID <= 1;ESPID++)
{
Target.GetPos(ESPID);
angleX = _degree(atan(abs(Target.y-Local.y)/abs(Target.x-Local.x)));
if (Target.x < Local.x)
angleX+=180;
if ((Target.x > Local.x && Local.y > Target.y) || (Target.x < Local.x && Local.y < Target.y))
angleX = 360-angleX;
dist = sqrt((pow(Target.x-Local.x, 2)+pow(Target.y-Local.y, 2)+pow(Target.z-Local.z, 2)));
angleY = _degree(acos((Target.z-Local.z)/dist))-90;
xOFF = angleX-Local.yaw; //get angle from my crosshair
if (xOFF < -180)
xOFF+=360;
else if (xOFF > 180)
xOFF-=360;
yOFF = angleY-Local.pitch; //get angle from my crosshair
xPixel = xOFF/0.088;
yPixel = yOFF/0.099;
boxScale = (1024 * 64 / (dist * (2*tan(32.5)))); //get box size
DrawBox(HLDC, screencenter[0]-xPixel, screencenter[1]+yPixel, boxScale, boxScale*2, 0x00CD2626); //draw box
}
I was wondering if anyone could help me out, or give me some hints into the right direction.