Skip to main content

Screen to World

screen to world

Use Screen to World to transform a position from camera viewport space to world space. The input viewport space is normalized to the camera. The bottom left of the camera viewport is (0,0) and the top right is (1,1). The Z position is in world units from the camera. Screen to World is in the Transform category.

Input

NameData TypeDescription
Screen PosVec2The position in viewport space.
Z DepthNumberThe Z position in world units from the camera.
CameraCamera componentThe Camera component that provides the input viewport space.

Output

NameData TypeDescription
World PosVec3The position in world space.

Example

screen to world example

This example uses Screen to World to project the 2D touch point screen space coordinate obtained from the Screen Tap component, and uses this component to control the position of a 3D cube in the world space coordinate.

The Z Depth is the relative depth compared to the target camera. In this example, the camera is placed at Vec3 (0,0,40). The Z Depth is set to 40, so the cube’s Z will always be 0.

screen to world node