Solved Help with World2Screen

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

j3b

Jr.Coder
Full Member
Nobleman
Dec 18, 2012
67
408
1
Hello. I downloaded Fleeps ESP_MultiHack External to see on how to do an External ESP.
Since i dont want to fully copy his code im doing trying to do it myself....

But i have a problem with my World2Screen function...

Here is the code : https://pastie.org/6083594



The problem is when i run my program nothing comes up on the screen, so i checked ScreenX value, and it gave me" inf" and the ScreenY gave my "nan".

And ofc i tried to draw on the screen just random and it worked.

Soo my World2Screen function is wrong since it give me infitie values on ScreenX and soo on.

Anyone got any ideas?


Im doing it for the Source Engine ( Does it matter what World2Screen function you use? Isnt it the same math for all FPS games etc? )
 

ndani14

Nick
Dank Tier Donator
Nobleman
Aug 27, 2012
52
708
1
Hey from what i can see the equations seem correct as long as the
fov[0] = tan(verticle FOV)
fov[1] = tan(horizontal FOV)

Are you sure that the up, forward and right vectors are being set properly?

I'm guessing it's done in.
AngleVectors();
 

j3b

Jr.Coder
Full Member
Nobleman
Dec 18, 2012
67
408
1
I probably missed the viewAngle thing here, but my question is.. why do i need to kno the viewAngle of enemies... Dont i just need the Players address?
 

j3b

Jr.Coder
Full Member
Nobleman
Dec 18, 2012
67
408
1
Okay, i fixed the fov now... and i used myPlayers viewangle, the boxes shows up.... but on the wrong places. Any ideas :) ?


Does it matter which World2Screen func i use?
 

j3b

Jr.Coder
Full Member
Nobleman
Dec 18, 2012
67
408
1
Well, i have them on my screen now, the boxes... but the problem is that its not on the enemy.

And i dont kno why you told me to set fov[0] = tan(FOV-VALUE) and soo on.. since Fleep is not doing it in his source code





here is my code now : https://pastie.org/6089507
 
Last edited:

ndani14

Nick
Dank Tier Donator
Nobleman
Aug 27, 2012
52
708
1
Do you understand how to derive the equations?
If not are you willing to learn how to?

Btw what game is it for?
 

j3b

Jr.Coder
Full Member
Nobleman
Dec 18, 2012
67
408
1
Do you understand how to derive the equations?
If not are you willing to learn how to?

Btw what game is it for?

Well, i fixed it now... In Fleeps code its something like 1/fov[1] ... i changed 1 to 90 and it works now. It render now the box on the player... But sometimes abit over or under the player, depends on the situation :)
Have to fix that!
Thanks anyways...

but still doesnt kno why you said fov[0] = tan(theValue) :D
 

ndani14

Nick
Dank Tier Donator
Nobleman
Aug 27, 2012
52
708
1
but still doesnt kno why you said fov[0] = tan(theValue) :D
it's to do with the perspective equation, if you look at the site i linked earlier the S = 1 / tan(fov * 0.5 * pi/180) [if fov is in degrees]
my bad i forgot the divide by 2 :p silly me

maybe try (fov in degrees)
fov[0] = tan(fov * 0.5 * PI/180.0)*(screen_width*1.0/screen_height)
fov[1] = tan(fov * 0.5 * PI/180.0)

anyway good luck
 
Attention! Before you post:

Read the How to Ask Questions Guide
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
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods