# Thread: What is World To Screen?

1. ## What is World To Screen?

I am new at hacking so please explain to me what is WorldToScreen?

Thank you

2. It is a function where it takes three dimensional coordinates and makes them two dimensional coordinates so u can work with them easier.

For example, this is how name esp is made. You get the two dimensional coordinates of the players body position and then u just add some to the y coordinate to position their name above their head, or below if that floats ur boat

3. ## The Following User Says Thank You to 258456 For This Useful Post:

u.A.v.A (05-25-2012)

4. Gameworlds are a 3 dimensional space, You can move up/down, left/right and forward/backwards. Your screen however is 2 dimensional, you can only go left/right and up/down.

World to Screen basically allows you to calculate the screen coordinates for a given world coordinate using some advanced maths.
Typically you'll need the following:
* Camera position
* Camera rotation
* Camera field of view(fov)
* Screen resolution
* A point in the world that you want to know the screen coordinates of.

If you have all of those you can calculate the screen position with some fancy maths. There's different approaches, the only one I've worked with is roughly the following:
Calculate the angles to aim at the point you want to convert.
is within our field of view(thus the difference is between -0.5*fov and 0.5*fov)?
If not: it's not on our screen
If it is: do the following(hard to explain in only words so here's a little drawing)

So, lets say we've done the maths(you should be able to figure out what to do based on the information below)
We've found that the length of the plane is 100 units(from -50 to 50 to make it easier to follow), and our enemy is at -20.
Our screen is 1920 in width.
Now we can calculate that every full unit is 1920/100 = 19.2 pixels.
We'll work from the middle of our screen, -20 * 19.2 + 960 = 576, so our enemy is at X = 576 on our screen.

The same stuff applies to the height on the screen, except you won't use 90 as FOV. you'll have to divide it by your aspect ratio to get the horizontal fov.

5. ## The Following 2 Users Say Thank You to Hell_Demon For This Useful Post:

intervention61 (06-28-2012), u.A.v.A (05-25-2012)

6. I just figure it out yesterday but @Hell_Demon thanks for the extra information