Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: ℛḝξ☂ on August 24th, 2021, 02:14 AM

Title: Client function ScreenPosToWorld
Post by: ℛḝξ☂ on August 24th, 2021, 02:14 AM
GUI::ScreenPosToWorld(Vector screenPosition)

I wonder how this function works, and why the parameter screen position is Vector instead of VectorScreen, any help is appreciated!
Title: Re: Client function ScreenPosToWorld
Post by: Xmair on August 24th, 2021, 06:43 AM
This function is used to convert the world's 3D co-ordinates to the client's 2D screen co-ordinates.
Title: Re: Client function ScreenPosToWorld
Post by: DizzasTeR on August 24th, 2021, 10:21 AM
Quote from Xmair on August 24th, 2021, 06:43 AM
This function is used to convert the world's 3D co-ordinates to the client's 2D screen co-ordinates.
Its the other way around. The Z parameter in Screen -> World Pos or World Pos -> Screen represents visibility. Value is between -1 or 0 (forgot exactly) if the vector is not visible on screen and anything else if it is. (You probably have to test)
Title: Re: Client function ScreenPosToWorld
Post by: Xmair on August 24th, 2021, 07:39 PM
Quote from DizzasTeR on August 24th, 2021, 10:21 AM
Quote from Xmair on August 24th, 2021, 06:43 AM
This function is used to convert the world's 3D co-ordinates to the client's 2D screen co-ordinates.
Its the other way around. The Z parameter in Screen -> World Pos or World Pos -> Screen represents visibility. Value is between -1 or 0 (forgot exactly) if the vector is not visible on screen and anything else if it is. (You probably have to test)
My bad, didn't read the function name closely. If the Z coordinate is in negative, the vector is formed behind the player's screen (from my last experiment)
Title: Re: Client function ScreenPosToWorld
Post by: ℛḝξ☂ on August 27th, 2021, 03:15 AM
Thank you both for your help!
Quote from DizzasTeR on August 24th, 2021, 10:21 AM
Quote from Xmair on August 24th, 2021, 06:43 AM
This function is used to convert the world's 3D co-ordinates to the client's 2D screen co-ordinates.
Its the other way around. The Z parameter in Screen -> World Pos or World Pos -> Screen represents visibility. Value is between -1 or 0 (forgot exactly) if the vector is not visible on screen and anything else if it is. (You probably have to test)
I am using this function to enable players to mark a certain place with a sprite. Your information helps and this work is done! Btw if I change the value of Z parameter in Screen position to 0 or -1 I cannot see the mark/sprite, I try to use 1 and it works.