# Get3DVectorZFromScreen

## Description

Converts a 2D point on the screen into a vector pointing into the 3D world. The vector is normalised to 1 unit long, to extend it into the world simply multiply it by your desired distance.

If the camera is using an orthographic projection matrix then this command behaves slightly differently, since all points on the screen would produce the same vector pointing away from the camera, but each originating from a different point in 3D space. This differs from a perspective projection where all vectors start at the camera position and fan out as they move away from the camera. So when using an orthographic projection matrix this command will instead return a sideways unnormalised vector from the camera position to the point in 3D space that the vector should start. This can then be combined with a vector that points away from the camera to create a ray cast into the scene.

## Definition

float Get3DVectorZFromScreen( x, y )

float agk::Get3DVectorZFromScreen( float x, float y )

## Parameters

*x* - The X component of the screen position.*y* - The Y component of the screen position.