# SolvedAimbot X wrong

#### TheLeandroNex

##### Newbie
Hello there, well i'm making a C# assault cube hack.
I already get the enemy pos and the player pos.
So all that i need to do is Aim at the enemy.
but the x(vertical) is going always in the middle of the screen.

CODE :
C#:
``````Vector3 enemy = enemies[ClosestEnemy];

Vector3 m = player - enemy;
float x = (float)(Math.Atan2(m.y, m.z) * (Math.PI / 180));
float y = (float)(-Math.Atan2(m.x * Math.Cos(x), m.z) * (180 / Math.PI));
float z = (float)(Math.Atan2(Math.Cos(x), Math.Sin(x) * Math.Sin(y)) / (Math.PI * 180));
Any help ?

#### Solaire

##### Respected Hacker
Dank Tier VIP
Hello there, well i'm making a C# assault cube hack.
I already get the enemy pos and the player pos.
So all that i need to do is Aim at the enemy.
but the x(vertical) is going always in the middle of the screen.

CODE :
C#:
``````Vector3 enemy = enemies[ClosestEnemy];

Vector3 m = player - enemy;
float x = (float)(Math.Atan2(m.y, m.z) * (Math.PI / 180));
float y = (float)(-Math.Atan2(m.x * Math.Cos(x), m.z) * (180 / Math.PI));
float z = (float)(Math.Atan2(Math.Cos(x), Math.Sin(x) * Math.Sin(y)) / (Math.PI * 180));
Any help ?

Best I can do

C++:
``````    dists = us - them;
float hyp = dists.magnitude();

result.x = toDeg(atanf(dists.y / dists.x)) + 90;
result.y = toDeg(asinf(dists.z / hyp));

result.y = -result.y;

if (dists.x >= 0)
result.x += 180;``````
X should be left/right view angles (Yaw), Y should be up/down view angles (Pitch), and Z (Roll) can generally be left alone unless the game uses it (Such as for planes, vehicles, etc). Look up aimbot math if you want an explanation on how it works.

Last edited:
• #### TheLeandroNex

##### Newbie
Best I can do

C++:
``````    dists = us - them;
float hyp = dists.magnitude();

result.x = toDeg(atanf(dists.y / dists.x)) + 90;
result.y = toDeg(asinf(dists.z / hyp));

result.y = -result.y;

if (dists.x >= 0)
result.x += 180;``````
X should be left/right view angles (Yaw), Y should be up/down view angles (Pitch), and Z (Roll) can generally be left alone unless the game uses it (Such as for planes, vehicles, etc). Look up aimbot math if you want an explanation on how it works.
Hey, thanks it works #### Rake

noooooooooooooooice solaire

• #### Jaimy

##### Newbie
Full Member
Hello there, well i'm making a C# assault cube hack.
I already get the enemy pos and the player pos.
So all that i need to do is Aim at the enemy.
but the x(vertical) is going always in the middle of the screen.

CODE :
C#:
``````Vector3 enemy = enemies[ClosestEnemy];

Vector3 m = player - enemy;
float x = (float)(Math.Atan2(m.y, m.z) * (Math.PI / 180));
float y = (float)(-Math.Atan2(m.x * Math.Cos(x), m.z) * (180 / Math.PI));
float z = (float)(Math.Atan2(Math.Cos(x), Math.Sin(x) * Math.Sin(y)) / (Math.PI * 180));
Any help ?
how do you write that code ? #### Solaire

##### Respected Hacker
Dank Tier VIP
how do you write that code ? By trying, and not wasting time trolling on a forum.

Attention! Before you post:

99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

• Fill out the form correctly
• Tell us the game name & coding language 