Page tree
Skip to end of metadata
Go to start of metadata



This command / function is broken and / or unreliable in VBS4.

Introduced in

Version:1.22

Description

Description:Converts position in world space into screen (UI) space.
If a specified position is not within the current map view, an empty array is returned.
Does not currently support output from the camSetTarget command

Syntax

Syntax:worldToScreen position
Parameters:
  • position: Array - 2D or 3D position
Return Value:Position2D - Screen position (upper left=[0,0], lower right=[1,1])

Alternative Syntax

Syntax:worldToScreen [position, cursorTarget] (17.4.0+)
Parameters:
  • position: Array - 2D or 3D position
  • camera: Object - Object of type "camera"
Return Value:Position2D - Screen position (upper left=[0,0], lower right=[1,1])

Examples

Examples:
_scPos = worldToScreen (getpos player)
_scPos = worldToScreen [getpos player, myCamera]

Additional Information

See also:screenToWorldaimPos2D
Multiplayer:
Problems:

Notes





Be aware that this command doesn't know what aspect ratio you are using. VBS2 can handle up to triple head aspect ratio, which is 3 screens wide. This command will return positions out to this maximum width (x=-1 to x=2), even if you aren't using triple-head. --
General Barron
02:48, 4 August 2009 (CEST)