# SolvedMaking an aimbot and calculating coordinates

#### Jabberwock

##### Newbie
Hi guys, it's me again.

I need help in the calculations of an aimbot.(A memory aimbot)

I have all the addresses I just have trouble calculating the hack itself. So here are the types:

The player coordinates x, y and z are float type.
The cursor coordinates x and y are WORD type.

I have tried a tutorial here.

But for some reason the cursor jumps all over and behaves weirdly.
Some help appreciated. Thanks in advance.

Last edited:

#### ndani14

##### Nick
Dank Tier Donator
Nobleman
Hey Jabberwock,

Just need to clear a few things up before I can help.

The things you need for the aimbot are:

Player:
position (x, y, z)
direction you're looking (usually in Euler angles)

And a position to look at. (Enemies head position.. )

Do you have the direction the player is looking?

Jabberwock

#### ndani14

##### Nick
Dank Tier Donator
Nobleman
ok cool,

You're going to need to check if the cursor coordinates are in degrees or radians. (if it's not either then please post what game it is or what they are set to when you look up, look down, look straight and a few others)

Also you may need to check what coordinate system is being used.
Most games I've seen have X - right, Z - forward, Y - up

Y Z
| /
|/_ _ X

O - The players position
P - Position to look at

// get the relative coordinates
float dx = P.x - O.x;
float dy = P.y - O.y;
float dz = P.z - O.z;

// the length of the vector
float m = sqrt(dx*dx + dy*dy + dz*dz);

if(m < 0.000001) // if this is true then the position you want to look at is too close to you
return; // be careful not to divide by zero...

// normalise the vector
dx = dx / m;
dy = dy / m;
dz = dz / m;

if(fabs(dz) > 0.9999999) { // special case
if(dz < 0) {
// look down
// just set the mouseY to be down degress (-90) radians (-PI/2)
} else {
// look up
// just set the mouseY to be down degress (90) radians (PI/2)
}

return;
}

. /|
a/ |dz
/__|
dx

float a = sqrt(1 - dy*dy);

float mouseX = acos(dx/a);

. /|
1/ |dy
/__|
a

float mouseY = asin(dy);

// some games also have strange things where they add/minus an extra 90 degrees to the mouseX

// if the game is in radians you should be able to just set mouseX and mouseY now

// if the game is in degrees just convert it to degrees by

mouseX *= 180.0f / PI;
mouseY *= 180.0f / PI;

// now set them

Not sure if this explains it very well but it may help you figure out what you need

Last edited:
Jabberwock

#### Jabberwock

##### Newbie
Wow, thank you very much. Finally someone who explains it well!

The mouse coordinates are WORD type and they are not in degrees or radians.

The mouse Y:
straight = 0.
down = 50535.
up = 15000

The mouse X:

When setting to 0 and going to that direction the x coordinate get higher.
When setting to 32768 and going to that direction the x coordinate get lower.
When setting to 16384 and going to that direction the y coordinate get higher.
When setting to 49152 and going to that direction the y coordinate get lower.

Also I might made a mistake and swapped between the z and y. From my understanding when going up a ladder in the game the z coordinate is the one that grow right?

Thank you very much for helping me!

#### ndani14

##### Nick
Dank Tier Donator
Nobleman
wow those are some strange values lol. what game is it?

Jabberwock

#### Jabberwock

##### Newbie
Alliance of Valiant Arms (AVA).

#### ndani14

##### Nick
Dank Tier Donator
Nobleman
Try these out, they should be close

[mouseX and mouseY are from before] (the radian versions)

short newMouseY = (short)(15000 * mouseY / (PI / 2));
short newMouseX = (short)(32767 * mouseX / PI);

Jabberwock

#### Jabberwock

##### Newbie
Now it acts weirdly but it does react to the movement of the player.

Just to be sure that I'm right about the x, y and z. When going up a ladder in the game which one of them will increase? The z or the y? In some graphs I see the y and others the z...

#### ndani14

##### Nick
Dank Tier Donator
Nobleman
with the coordinate system i'm using y should increase.

also the newMouseX may need to 32767 to be change i just guessed that one.

#### Jabberwock

##### Newbie
Thanks for the quick response. Also I see that you type casted them both to short type but they are actually unsigned short.

#### ndani14

##### Nick
Dank Tier Donator
Nobleman
I believe they are actually shorts in the game, if you look at 50535 as signed it's -15001