# SolvedAimbot Math is off

#### B14CKS1D3

##### Newbie
Full Member
My aimbot dosen't really aim where it is suppoed to. Tried a few ways of doing it, and the one that is the closest to the peds is the CalcAngles one.
Here is my function
C++:
``````void CalcAngles(Vec source, Vec Destination, float angles){
float delta = { (source.x - Destination.x), (source.y - Destination.y), (source.z - Destination.z) };
float hyp = sqrt(delta * delta + delta * delta);
angles = (float)(asinf(delta / hyp) * 57.295779513082f);
float theta = (float)(atanf(delta / delta) * 57.295779513082f);//yaw in degrees
if (delta >= 0.0) theta += 180.0f;
/*Code below is because I write to the rotation matrix (There is no yaw only values)*/
theta = theta  * (M_PI / 180.0f) + aimbotOffset;//Deg->Rad
float vX = hyp * cos(theta);
float vY = hyp * sin(theta);
angles = vX;
angles = vY;
}``````
Anyone can help me getting this working? Btw, Vec = 3 floats (x, y, z)

#### Rake

My aimbot dosen't really aim where it is suppoed to. Tried a few ways of doing it, and the one that is the closest to the peds is the CalcAngles one.
Here is my function
C++:
``````void CalcAngles(Vec source, Vec Destination, float angles){
float delta = { (source.x - Destination.x), (source.y - Destination.y), (source.z - Destination.z) };
float hyp = sqrt(delta * delta + delta * delta);
angles = (float)(asinf(delta / hyp) * 57.295779513082f);
float theta = (float)(atanf(delta / delta) * 57.295779513082f);//yaw in degrees
if (delta >= 0.0) theta += 180.0f;
/*Code below is because I write to the rotation matrix (There is no yaw only values)*/
theta = theta  * (M_PI / 180.0f) + aimbotOffset;//Deg->Rad
float vX = hyp * cos(theta);
float vY = hyp * sin(theta);
angles = vX;
angles = vY;
}``````
Anyone can help me getting this working? Btw, Vec = 3 floats (x, y, z)
C++:
``````vec3_t CalcAngle(vec3_t src, vec3_t dst)
{
vec3_t angles;
angles.x = (-(float)atan2(dst.x - src.x, dst.y - src.y)) / PI * 180.0f + 180.0f;
angles.y = (atan2(dst.z - src.z, Distance(src, dst))) * 180.0f / PI;
angles.z = 0.0f;
return angles;
}``````

• #### B14CKS1D3

##### Newbie
Full Member
Rake;42183 said:
C++:
``````vec3_t CalcAngle(vec3_t src, vec3_t dst)
{
vec3_t angles;
angles.x = (-(float)atan2(dst.x - src.x, dst.y - src.y)) / PI * 180.0f + 180.0f;
angles.y = (atan2(dst.z - src.z, Distance(src, dst))) * 180.0f / PI;
angles.z = 0.0f;
return angles;
}``````
PÃ®tch moves up and down when I move my character.
Haven't figured how to convert yaw for the rotation matrix yet with this function
Idk if the fact that the character isn't 100% centered while aiming can do something Last edited:

#### Rake

PÃ®tch moves up and down when I move my character.
Haven't figured how to convert yaw for the rotation matrix yet with this function
Idk if the fact that the character isn't 100% centered while aiming can do something Game is in third person view...no idea how to help #### PwndDepot

##### I has a status
Dank Tier VIP
Trump Tier Donator
Dank Tier Donator
Rake;42193 said:
Game is in third person view...no idea how to help GTA V is both 3rd person and 1st person, just like battlefront, so switch to first person mode and see if it works I guess

• #### B14CKS1D3

##### Newbie
Full Member
GTA V is both 3rd person and 1st person, just like battlefront, so switch to first person mode and see if it works I guess
GTA dosen't use the same memory addresses for first person view, and since I don't ever use first person view in gta, I didn't bother getting the addresses for it

#### B14CKS1D3

##### Newbie
Full Member
Finally figured it out, Thrid person shooter aimbots are the same as first person games. My error was that I wasn't grabbing the right coordinates to do the math from. I ended up using the same math as I posted for the yaw & Rake's math for pitch.

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 