WorldToScreen

From GECK
Jump to: navigation, search


A function added by the JohnnyGuitar NVSE Plugin.

Description

Converts world coordinates to screen coordinates. Returns X and Y (from 0 to 1) and Z distance (in camera units) from a point in the worldspace. Also returns if the object is on the screen.

If the desired values are pixel coordinates, the output X and Y values must be multiplied by the desired target resolution.

The parameter HandleType works for the offscreen calculations, possible values are:

0: Offscreen coordinates given as a square shape
1: Offscreen coordinates given as a circular shape
2: Offscreen calculations not made

If a reference is used, the input values will be used as offsets from that reference's position.

Syntax

[help]
(isOnScreen:int) WorldToScreen xOut:int yOut:int zOut:int xIn:float yIn:float zIn:float handleType:int reference:ref

Example

int xOut
int yOut
int zOut
int isOnScreen
...

set isOnScreen to WorldToScreen xOut yOut zOut 0 0 0 0 SunnyREF ; Gives us the screen position of SunnyREF