

Post Thanks / Like  4 Thanks

That's sweet as man, thanks for sharing.

I know this thread is old but hopefully. What if the player angles are not 0360 but infinity to +infinity. If I spin 5 times to the right, my xAng would be 3.56454 for example. Then if I spin 1 time around to the left, the ang would be 2.54648
resolved
I did not realise it's radians....
Last edited by Martinek951; 03192017 at 11:38 AM.

Speaking of this old thread, i have always found it very interesting but i could never manage to get it to work... Anyone have a more in depth explanation on this?

Originally Posted by
HexMurder
Speaking of this old thread, i have always found it very interesting but i could never manage to get it to work... Anyone have a more in depth explanation on this?
Problem with this is that it's simply incomplete. It won't be accurate. This is basically what's going on (sorry for shitty paint):
d: distance to near plane in world coordinates
a: angle between current yaw and aim angle (so a = yaw  aim_yaw)
b: Fov angle/2
Point P: own player/cam position (x/z coord)
Point E: enemy position (x/z coord)
Green Point: point on near plane where you have to draw the enemy
The main problem with this method is that you have to know how far the near plane is away from the player camera. The near plane is basically your screen. When you know the distance from the camera to the near plane or the width of the near plane in world coordinates you can easily calculate the ScreenX coordinate using similar triangles and trigonometry.
Edit: I might be completely wrong btw. Just saying.
Actually it is really easier:
Last edited by Broihon; 03192017 at 06:27 PM.

Post Thanks / Like  1 Thanks

Originally Posted by
Вroihon
Actually it is really easier:
I feel like this method would work very well for older games, but i am just misunderstanding something perhaps? The results i am getting with csgo are def wrong.
https://i.gyazo.com/c15db0fc2f05c5dd...4167bc00f8.mp4
The 2 in that video is being drawn with the W2S function. And the line is being drawn with this.
I orignially wrote it like this. (very sloppy but just for testing)
Code:
int FOV = 90;
float xDif = Engine.enemy[j].aimbotAngle.x  Engine.LocalPlayer.viewAngles.x;
int dx = Engine.screenSize.x / FOV;
xDif += FOV / 2;
xDif *= dx;
float yDif = Engine.enemy[j].aimbotAngle.y  Engine.LocalPlayer.viewAngles.y;
int dy = Engine.screenSize.y / FOV;
yDif += FOV / 2;
yDif *= dy;
but i was getting strange results. xDif would be between ~0 to ~1080, and yDif would be between ~0 to ~1920. When it should be x 0 to 1920 and y 0 to 1080.
so i did it again but this time calulated it with opposite screen coords.
Code:
int FOV = 90;
float xDif = Engine.enemy[j].aimbotAngle.x  Engine.LocalPlayer.viewAngles.x;
int dx = Engine.screenSize.y / FOV;
xDif += FOV / 2;
xDif *= dx;
float yDif = Engine.enemy[j].aimbotAngle.y  Engine.LocalPlayer.viewAngles.y;
int dy = Engine.screenSize.x / FOV;
yDif += FOV / 2;
yDif *= dy;
And i also assigned them opposites as well.
Code:
Vec3 drawingPoint = new Vec3(1920  yDif, xDif, 0);
obviously there is something very wrong, because i had to do a lot of stupid things to even get this thing to half ass work. Help pls lmao.

Originally Posted by
HexMurder
I feel like this method would work very well for older games, but i am just misunderstanding something perhaps? The results i am getting with csgo are def wrong.
https://i.gyazo.com/c15db0fc2f05c5dd...4167bc00f8.mp4
The 2 in that video is being drawn with the W2S function. And the line is being drawn with this.
I orignially wrote it like this. (very sloppy but just for testing)
Code:
int FOV = 90;
float xDif = Engine.enemy[j].aimbotAngle.x  Engine.LocalPlayer.viewAngles.x;
int dx = Engine.screenSize.x / FOV;
xDif += FOV / 2;
xDif *= dx;
float yDif = Engine.enemy[j].aimbotAngle.y  Engine.LocalPlayer.viewAngles.y;
int dy = Engine.screenSize.y / FOV;
yDif += FOV / 2;
yDif *= dy;
but i was getting strange results. xDif would be between ~0 to ~1080, and yDif would be between ~0 to ~1920. When it should be x 0 to 1920 and y 0 to 1080.
so i did it again but this time calulated it with opposite screen coords.
Code:
int FOV = 90;
float xDif = Engine.enemy[j].aimbotAngle.x  Engine.LocalPlayer.viewAngles.x;
int dx = Engine.screenSize.y / FOV;
xDif += FOV / 2;
xDif *= dx;
float yDif = Engine.enemy[j].aimbotAngle.y  Engine.LocalPlayer.viewAngles.y;
int dy = Engine.screenSize.x / FOV;
yDif += FOV / 2;
yDif *= dy;
And i also assigned them opposites as well.
Code:
Vec3 drawingPoint = new Vec3(1920  yDif, xDif, 0);
obviously there is something very wrong, because i had to do a lot of stupid things to even get this thing to half ass work. Help pls lmao.
Again, this won't work because it treats numbers as linear functions even though you're dealing with angles shit. That's why it gets to far left/right and up/down. Your code is as correct as possible with this method.
You have to do the maths for the shitty diagram I posted if you want an FOV based w2s.

Post Thanks / Like  1 Thanks
N/A thanked for this post