SA-MP Forums Archive
(Screen 2D) -> (3D Points with specified distance) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: (Screen 2D) -> (3D Points with specified distance) (/showthread.php?tid=334040)



(Screen 2D) -> (3D Points with specified distance) - iPLEOMAX - 13.04.2012

Trigonometry experts, how would I do that?

What I have:

- X and Y Position in the screen.
- Width x Height, Resolution of screen in pixels (to roughly calculate player's field of view)

What I want:

- X,Y,Z in 3D Space with a distance specified by myself.

The function should look like this:
pawn Код:
ScreenToWorld(Float:ScreenX, Float:ScreenY, Float:Distance, &Float:X, &Float:Y, &Float:Z)
Consider this function already made:
pawn Код:
GetScreenResolution(playerid, &Float:Width, &Float:Height);



Re: (Screen 2D) -> (3D Points with specified distance) - ViniBorn - 13.04.2012

Would something like this?

pawn Код:
ScreenToWorld(ScreenX, ScreenY, 30, &Float:X, &Float:Y, &Float:Z)



Re: (Screen 2D) -> (3D Points with specified distance) - iPLEOMAX - 13.04.2012

Yes but in the image, the XYZ is in wrong place, it's supposed to be behind the screen xy.


AW: (Screen 2D) -> (3D Points with specified distance) - m33p4r34l - 24.04.2013

I'm really interessted in something like this, but idk how to realize that. Somebody already found a solution to transform Positions between 2D and 3D?


Re: (Screen 2D) -> (3D Points with specified distance) - mastermax7777 - 24.04.2013

lol.. this is not that simple


Re: (Screen 2D) -> (3D Points with specified distance) - whatthefuck123 - 06.11.2013

sht.. man


Re: (Screen 2D) -> (3D Points with specified distance) - Joe Staff - 06.11.2013

There a several complications to this. The coordinates of the player's camera updates slowly and
the world's objects (including terrain) are not calculated by the server, so you'll need a height map which will make it even more inaccurate


Re: (Screen 2D) -> (3D Points with specified distance) - whatthefuck123 - 06.11.2013

Quote:
Originally Posted by Joe Staff
Посмотреть сообщение
There a several complications to this. The coordinates of the player's camera updates slowly and
the world's objects (including terrain) are not calculated by the server, so you'll need a height map which will make it even more inaccurate
3d to 2d u dont have to worry about height map
i think thats unimportant the most hard stuff is the convertion


Re: (Screen 2D) -> (3D Points with specified distance) - iZN - 06.11.2013

The thread is one year old though, the OP might solved it.