[Include] Screen to World vice versa
#30

Quote:
Originally Posted by adri1
Посмотреть сообщение
Can you make an example? please.
First ScreenToWorld and how to calculate the position with a specific distance
Afterwards WorldToScreen which just takes a position in 3d and returns the x and y of the screen
pawn Код:
const
    Float: distance = 25.0
;
new
    Float: TextDrawX = 400.0,
    Float: TextDrawY = 300.0,
    Float: cameraX,
    Float: cameraY,
    Float: cameraZ,
    Float: vectorX,
    Float: vectorY,
    Float: vectorZ
;
// ScreenToWorld
GetPlayerCameraPos(playerid, cameraX, cameraY, cameraZ);
ScreenToWorld(playerid, TextDrawX, TextDrawY, vectorX, vectorY, vectorZ);

cameraX += vectorX * distance;
cameraY += vectorY * distance;
cameraZ += vectorZ * distance;

printf("%f %f %f", cameraX, cameraY, cameraZ);
// WorldToScreen
WorldToScreen(playerid, cameraX, cameraY, cameraZ, TextDrawX, TextDrawY);

printf("%f %f", TextDrawX, TextDrawY);
Reply


Messages In This Thread
Screen to World vice versa - by Nero_3D - 09.12.2013, 21:43
Re: Screen to World vice versa - by Patrick - 09.12.2013, 21:50
Re: Screen to World vice versa - by Vinnyy - 10.12.2013, 01:54
Re: Screen to World vice versa - by Kar - 10.12.2013, 02:07
Re: Screen to World vice versa - by Sublime - 10.12.2013, 02:20
Re: Screen to World vice versa - by ViruZz - 10.12.2013, 04:25
Re: Screen to World vice versa - by kristo - 10.12.2013, 10:56
Re: Screen to World vice versa - by iJumbo - 10.12.2013, 11:05
Re: Screen to World vice versa - by Slice - 10.12.2013, 11:12
Re: Screen to World vice versa - by Vinnyy - 10.12.2013, 13:30
Re: Screen to World vice versa - by Kyle - 10.12.2013, 15:01
Re: Screen to World vice versa - by Vinnyy - 11.12.2013, 02:08
Re: Screen to World vice versa - by SkittlesAreFalling - 11.12.2013, 02:36
Re: Screen to World vice versa - by Kaperstone - 11.12.2013, 03:01
Re: Screen to World vice versa - by iZN - 11.12.2013, 06:17
Re: Screen to World vice versa - by Emmet_ - 11.12.2013, 11:22
AW: Re: Screen to World vice versa - by Nero_3D - 11.12.2013, 17:11
Re: AW: Re: Screen to World vice versa - by Vinnyy - 12.12.2013, 03:15
AW: Screen to World vice versa - by LeBoyce - 12.12.2013, 15:37
Respuesta: Screen to World vice versa - by adri1 - 14.06.2014, 20:34
AW: Respuesta: Screen to World vice versa - by Nero_3D - 14.06.2014, 21:10
Re: Screen to World vice versa - by VladimirMark - 14.06.2014, 21:31
Re: Screen to World vice versa - by MacT - 18.06.2014, 20:45
Respuesta: Screen to World vice versa - by adri1 - 21.06.2014, 21:10
AW: Screen to World vice versa - by Nero_3D - 21.06.2014, 23:42
Respuesta: Screen to World vice versa - by adri1 - 22.06.2014, 15:14
AW: Respuesta: Screen to World vice versa - by Nero_3D - 22.06.2014, 17:19
Respuesta: Screen to World vice versa - by adri1 - 22.06.2014, 17:23
Re: Screen to World vice versa - by iRaiDeN - 22.06.2014, 19:33
AW: Respuesta: Screen to World vice versa - by Nero_3D - 23.06.2014, 16:07
Re: Screen to World vice versa - by codectile - 04.06.2015, 09:38

Forum Jump:


Users browsing this thread: 4 Guest(s)