void VectorAngles( const float* forward, float* angles )
{
float tmp, yaw, pitch;
if( forward[2] == 0 && forward[0] == 0 )
{
yaw = 0;
if( forward[2] > 0 )
pitch = 90;
else
pitch = 270;
}
else
{
yaw = ( atan2( forward[2], -forward[0] ) * 180 / M_PI )-90;
if( yaw < 0 )
yaw += 360;
tmp = sqrt( forward[0] * forward[0] + forward[2] * forward[2] );
pitch = ( atan2( forward[1], tmp) * 180 / M_PI );
if( pitch < 0 )
pitch += 360;
}
angles[0] = -pitch;
angles[1] = yaw;
angles[2] = 0;
}
void GetAngleToTarget(D3DXVECTOR3 vTargetPos, D3DXVECTOR3 vCameraPos, D3DXVECTOR3& vAngles)
{
D3DXVECTOR3 vDelta;
vDelta.x = vTargetPos.x - vCameraPos.x;
vDelta.y = vTargetPos.y - vCameraPos.y;
vDelta.z = vTargetPos.z - vCameraPos.z;
VectorAngles( (float*)&vDelta, (float*)&vAngles );
if( vAngles.x > 180.0f )
vAngles.x -= 360.0f;
else if( vAngles.x < -180.0f )
vAngles.x += 360.0f;
if( vAngles.y > 180.0f )
vAngles.y -= 360.0f;
else if( vAngles.y < -180.0f )
vAngles.y += 360.0f;
}
////////////////////Insira em seu loop com os jogadores///////////////////////
float Distancia = GetDistance(pLocal->Pos, pPlayer->Pos)/48; // calcula a distancia
if(Distancia < 50.0f) // 50.0f é um exemplo
{
D3DXVECTOR3 Angles;
GetAngleToTarget(pPlayer->Pos, pLocal->Pos/*ou CameraPos*/, Angles); // Você deve usar o calculo do angulo que voce usa em seu aimbot, este é somente um exemplo
float yaw = pCursor->Yaw; // Valor do cursor
float ang = ( DegToRad( Angles[YAW] ) - yaw ) + DegToRad( 90 );
float dx = PosicaoRadarX + 74 - 1 - cos( ang ) * Distancia;//faça seu ajuste
float dy = PosicaoRadarY + 74 - 1 - sin( ang ) * Distancia;//faça seu ajuste
if(dx < PosicaoRadarX)
dx = PosicaoRadarX;
if(dx > PosicaoRadarX + 150)
dx = PosicaoRadarX + 150 - 3;
if(dy < PosicaoRadarY)
dy = PosicaoRadarY;
if(dy > PosicaoRadarY + 150)
dy = PosicaoRadarY + 150 - 3;
if(pPlayer->team != pLocal->team)
DrawBox((int)dx, (int)dy, 2, 2, Red, Red, pDevice);
else
DrawBox((int)dx, (int)dy, 2, 2, Blue, Blue, pDevice);
}
////////////////////////////////////////////////////////////////
Basta criar uma box e colocar