Skip to main content
TikTok Effect House Platform Logo
Download
Log in
Transform

Screen to World

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.

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

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

Note that the Z Depth is the relative depth compared to the target camera. In the example setup, the camera is placed at Vec3 (0,0,40), we set a Z Depth of 40, then the cube’s Z will always be 0.