Hi,

I'm having a bit of trouble with angle calculation in the vertical direction (ie. 'yaw'). I've been following Fleeps C++ aimbot tutorial, and what follows is a description of my problem, along with the CalcAngle function.

Firstly, the planar angle (left-right, or 'pitch') is correct, always.

However, the yaw is wrong. When I'm on equal level with the enemy, it produces the correct angle. When I'm directly above or below the enemy, it produces the right angle. But as I move the target up from flat ground, more and more will my aim be higher than the enemies position. As I start approaching vertically above, it then becomes more accurate.

So it other words, it generally aims higher than required when the enemy is above you, and lower than required when the enemy is below you.

Does anyone have any suggestions?

I'm having a bit of trouble with angle calculation in the vertical direction (ie. 'yaw'). I've been following Fleeps C++ aimbot tutorial, and what follows is a description of my problem, along with the CalcAngle function.

Firstly, the planar angle (left-right, or 'pitch') is correct, always.

However, the yaw is wrong. When I'm on equal level with the enemy, it produces the correct angle. When I'm directly above or below the enemy, it produces the right angle. But as I move the target up from flat ground, more and more will my aim be higher than the enemies position. As I start approaching vertically above, it then becomes more accurate.

So it other words, it generally aims higher than required when the enemy is above you, and lower than required when the enemy is below you.

Does anyone have any suggestions?

C++:

```
void CalcAngle(float *src, float *dst, float *angles)
{
double delta[3] = { (src[0]-dst[0]), (src[1]-dst[1]), (src[2]-dst[2]) };
double hyp = sqrt((delta[0]*delta[0] + delta[2]*delta[2]));
// XMOUSE
angles[0] = (float) (atan2(delta[0], delta[2])) + PI;
// YMOUSE
angles[1] = (float) (atanf(-delta[1]/hyp));
```

Last edited: