Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 10:26

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Help!!! AimbotMath

Discussion on Help!!! AimbotMath within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Apr 2011
Posts: 363
Received Thanks: 167
Help!!! AimbotMath

Hi Epvpers i read a lot of tutorials of memory aimbots and made one by myself with autoit x_X, the thing is that some math in the code is wrong and don't know how to fix it, caus i'm very bad at maths...

All i can say is that the rotation x is working good from left to right and the y rotation only work if the enemy is at the same yPos as you D: but fortunately it shots at head ,right to left is not aiming even if the player that is on your left is the nearest.

Is an offline aimbot that will aim the nearest bot(team too(by now the nearest bot on your right)) when you press right click.


Things to consider:

rotationX (mouseX) go between 0 to 360
rotationY (mouseY) go between -89 to +89


i'm a stupid noob that i can't calculate the angle...

Here's the video:


Here is what i get until now:
Code:
Global Const $_PI =3.14159265

;Posible something bad in here? i get it from autoit forums...
#region Math Atan2
Func atan2($x, $y)
        $Pi = 4 * ATan(1)
        If StringIsInt($x) Or StringIsFloat($x) Then
                If StringIsInt($y) Or StringIsFloat($y) Then
                        ; OK
                Else
                        SetError(1)
                        Return ""
                EndIf
        Else
                SetError(1)
                Return ""
        EndIf
        Dim $PolarAnswer[3] ; $Results[0]=Radius, [1]=Theta (in Radians), [2]=Theta (in Degrees)
        $r = Sqrt(($x ^ 2) + ($y ^ 2))
        $PolarAnswer[0] = $r
        Select
                Case $x = 0 And $y = 0
                        $ThetaRad = 0
                        $ThetaDeg = 0
                Case $x >= 0 And $y >= 0 ; +x/+y = 0-90deg quadrant
                        $ThetaRad = ATan($x / $y)
                        $ThetaDeg = $ThetaRad * 180 / $Pi
                Case $x >= 0 And $y < 0 ; +x/-y = 90-180deg quadrant
                        $ThetaRad = ATan(Abs($y) / $x)
                        $ThetaDeg = $ThetaRad * 180 / $Pi + 90
                        $ThetaRad = $ThetaRad + $Pi / 2
                Case $x < 0 And $y < 0 ; -x/-y = 180-270deg quadrant
                        $ThetaRad = ATan(Abs($x) / Abs($y))
                        $ThetaDeg = $ThetaRad * 180 / $Pi + 180
                        $ThetaRad = $ThetaRad + $Pi
                Case $x < 0 And $y >= 0 ; -x/+y = 2700-360deg quadrant
                        $ThetaRad = ATan($y / Abs($x))
                        $ThetaDeg = $ThetaRad * 180 / $Pi + 270
                        $ThetaRad = $ThetaRad + 3 * $Pi / 2
        EndSelect
        $PolarAnswer[1] = $ThetaDeg
        SetError(0)
        Return $ThetaDeg
	EndFunc   ;==>atan2
#endregion

#region Aimbot Math
;EnemyVals[0,1,2] = xyz (All bots)
;PlayerVals[0,1,2] = xyz (Main Player)
Func Get3dDistance($EnemyVals,$PlayerVals)
	$float=Sqrt( _
	(($EnemyVals[0] - $PlayerVals[0]) * ($EnemyVals[0] - $PlayerVals[0]))+ _
	(($EnemyVals[1] - $PlayerVals[1]) * ($EnemyVals[1] - $PlayerVals[1]))+ _
	(($EnemyVals[2] - $PlayerVals[2]) * ($EnemyVals[2] - $PlayerVals[2])))
	Return $float
EndFunc




#cs
Something here is wrong
#ce
Func AimAtTarget($EnemyVal,$PlayerVal)
;                        Z            Z                          xyz       xyz
	$PitchX= ASin(($EnemyVal[2]-$PlayerVal[2])/Get3dDistance($EnemyVal,$PlayerVal))*180/$_PI
    $PitchY= -Atan2($EnemyVal[0]-$PlayerVal[0],$EnemyVal[1]-$PlayerVal[1])/($_PI*180*88)
;                       X           X              Y            Y

Local $MouseX= _MemoryWrite($MouseAdd[0][0],$Open,$PitchX,"float") ;x mouse axis
Local $MouseY= _MemoryWrite($MouseAdd[1][0],$Open,$PitchY,"float") ;y mouse axis

EndFunc

#endregion
Very sorry for my bad english the video will be uploaded in two hours (fail internet)
elmarcia is offline  
Old 06/01/2013, 11:30   #2
 
YatoDev's Avatar
 
elite*gold: 50
Join Date: Sep 2012
Posts: 3,841
Received Thanks: 1,462
Quote:
Originally Posted by FacePalmMan View Post
just rewrite your aimbot so it works like this:
make an esp-dot/esp-image ,let autoit search for it with pixel-/imagesearch and let autoit aim&click on it.

why you should rewrite it:
1. its easier to do
2. you can even see where the enemys are

Why searching for pixels in a aimbot ?
Why drawing esp ?
He asked how he calculate the position and not how he can make some bullshit of pixel aimbot .

B2T
I dont understand his problem so i cant help but i thing if you search you will find error , just test ^^

For aimbot you need your position and then calculate like this : You X - enemy X this wont work but you can test something like this
YatoDev is offline  
Old 06/01/2013, 11:50   #3
 
-STORM-'s Avatar
 
elite*gold: 124
Join Date: Dec 2009
Posts: 2,114
Received Thanks: 3,142
Pixelsearch is easy to use but will fail easily.

What you need are the positions [x,y,z] of the camera and the target. Both can be read in memory.
Then you have to calculate the vector that connects both points.
So [cam_x,cam_y,cam_z]-[target_x,target_y,target_z] = [cam_x-target_x,cam_y-target_y,cam_z-target_z] is that vector.

Then you need something to define the camera direction which can be different in any game.

Hopefully the camera direction is defined as a normal-vector [x,y,z] (a normal-vector's length always is 1). The length can be calculated as sqrt(x^2+y^2+z^2). So to get the desired normal-vector for the camera you need to calculate the connector-vector's length like that and then divide it so that it's length becomes 1. For instance if the connector-vector's length is 2.5, you divide each of the parameters x,y and z by 2.5 and change the camera's normal vector to that.

Probably the game uses a different way to define the camera direction, like two angles for example. In that case you have to calculate the normal-vector by these angles and change the angles to get the desired vector vice versa.
-STORM- is offline  
Thanks
1 User
Old 06/01/2013, 13:31   #4
 
Master674b's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 255
Received Thanks: 110
If you would use the search function you would have found this thread:

And you would have seen that I already answered this question.

Code:
vec3 diff = target - camPos
float distance2 = sqrt(pow(diff.x, 2) + pow(diff.y, 2))
float yaw = normalize0to2pi(atan2(diff.y, diff.x))
float pitch = normalize0to2pi(atan2(diff.z, distance2))
1. Build a vector that points from your face (camera) to your target.
2. Yaw is the opposite side (Y) / adjacent side (X) of your vectors right-angled triangle.
3. Pitch is basically the same but the opposide side "up" is Z and the adjacent side is the pythagorean XY distance between you and your target.
Master674b is offline  
Old 06/01/2013, 15:36   #5
 
butter123's Avatar
 
elite*gold: 95
Join Date: May 2011
Posts: 982
Received Thanks: 189
as long as he doesnt say how the data for camera direction, player position and enemy position are given, you can not help him.
there are thousand of ways to get a position in a coordinate system. and yeah "a" coordinate system. it doesnt even have to be the cartesian.

and your linked thread is in german. i assume, that he is only speaking english... why else should he write in english^^
butter123 is offline  
Old 06/01/2013, 16:00   #6
 
-STORM-'s Avatar
 
elite*gold: 124
Join Date: Dec 2009
Posts: 2,114
Received Thanks: 3,142
When it comes to camera direction, you're right of course.
But why would one use polar coordinates or anything but cartesian coordinates to build a game?
-STORM- is offline  
Old 06/01/2013, 16:24   #7
 
butter123's Avatar
 
elite*gold: 95
Join Date: May 2011
Posts: 982
Received Thanks: 189
eg a game where you live on a sphere or sth...
but i was refering to the camera. im not much into game programming, but i think cartesian and spherical are both equally usefull.
butter123 is offline  
Old 06/01/2013, 16:51   #8
 
-STORM-'s Avatar
 
elite*gold: 124
Join Date: Dec 2009
Posts: 2,114
Received Thanks: 3,142
In case you're walking on a sphere, you could define that in polar coordinates indeed.
I've just never seen a game like this plus every game engine I know uses cartesic coordinates, so you couldn't simply use Unreal Engine or somthing but had to create an entire new engine.

Anyway that's of no importance. As you said, the camera direction is the main issue since there are plenty of ways to define it and every game uses a different approach.

Some games do even provide several different definitions of the camera direction while only one of them will change anything when being set to the desired value.
So you don't only have to find a way the direction is stored in memory, but find the one way that you can use to change the value.
-STORM- is offline  
Old 06/01/2013, 20:35   #9
 
butter123's Avatar
 
elite*gold: 95
Join Date: May 2011
Posts: 982
Received Thanks: 189
if position is cartesian and camera is in angles, then this should answer your questions
butter123 is offline  
Thanks
1 User
Old 06/02/2013, 04:01   #10
 
elite*gold: 0
Join Date: Apr 2011
Posts: 363
Received Thanks: 167
Quote:
Originally Posted by »FlutterShy™ View Post

Why searching for pixels in a aimbot ?
Why drawing esp ?
He asked how he calculate the position and not how he can make some bullshit of pixel aimbot .

B2T
I dont understand his problem so i cant help but i thing if you search you will find error , just test ^^

For aimbot you need your position and then calculate like this : You X - enemy X this wont work but you can test something like this
sorry if i didn't explain well this is a memory aimbot xyz are the pos of the mainplayer and also the bots, mousex and mousey (the pos of the aim lol)

Ok heres the complete source its all commented


Quote:
Originally Posted by butter123 View Post
if position is cartesian and camera is in angles, then this should answer your questions
Very clear explanation thanks a lot dude!
elmarcia is offline  
Old 06/02/2013, 08:53   #11
 
Master674b's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 255
Received Thanks: 110
Quote:
Originally Posted by butter123 View Post
if position is cartesian and camera is in angles, then this should answer your questions
You are not even building a vector correctly. V(PE) is V(OE) - V(OP).
Also asin/acos is NEVER used to calculate rotation angles. Always use atan2, otherwise you might end up with a division by zero exception.

atan2 looks like this:



As you can see it gets around the case X = 0.

If you want a working aimbot you should just do what I posted earlier.
Master674b is offline  
Thanks
1 User
Old 06/02/2013, 13:59   #12
 
butter123's Avatar
 
elite*gold: 95
Join Date: May 2011
Posts: 982
Received Thanks: 189
this is a mathematical calculation. about problems with sin^-1 calculation i dont know anything...
and because i used {0,0,0} for coordinate center OE = E.

and if you want to help him with ur posted link, then translate it for him...
butter123 is offline  
Old 06/02/2013, 16:23   #13
 
Master674b's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 255
Received Thanks: 110
Quote:
Originally Posted by butter123 View Post
this is a mathematical calculation. about problems with sin^-1 calculation i dont know anything...
and because i used {0,0,0} for coordinate center OE = E.

and if you want to help him with ur posted link, then translate it for him...
I used 0, 0, 0 for the origin as well but you are still not building that vector correctly. It has the wrong orientation.

If you would use asin it would result in something like this for pitch and yaw:

Code:
float yaw = normalize0to2pi(asin(Y [COLOR="Red"][B]/[/B][/COLOR] sqrt(pow(X, 2) + pow(Y, 2))));
float pitch = normalize0to2pi(asin(Z [COLOR="red"][B]/[/B][/COLOR] sqrt(pow(X, 2) + pow(Y, 2) + pow(Z, 2))));
Which is just weird, slow, and crashes if distance == 0 that is if your camera position is equal to the targets position. (Reason: You could end up with a division by zero!)

The most correct solution is to use what I posted earlier:

Code:
vec3 diff = target - camPos
float distance2 = sqrt(pow(diff.x, 2) + pow(diff.y, 2))
float yaw = normalize0to2pi(atan2(diff.y, diff.x))
float pitch = normalize0to2pi(atan2(diff.z, distance2))
You most likely won't need roll.
Master674b is offline  
Thanks
1 User
Old 06/02/2013, 17:38   #14
 
butter123's Avatar
 
elite*gold: 95
Join Date: May 2011
Posts: 982
Received Thanks: 189
oh ok ur right i corrected the picture, just a slip of the pen^^
butter123 is offline  
Reply




All times are GMT +1. The time now is 10:27.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.