Contents

ray(to:forViewPort:)

Returns a point, in 3D world coordinates, corresponding to the specified 2D view coordinates.

Declaration

func ray(to pixel: vector_int2, forViewPort size: vector_int2) -> vector_float3

Parameters

  • pixel:

    A point in the 2D pixel coordinate system of a possible renderer’s view.

  • size:

    The pixel dimensions of a possible renderer’s view.

Return Value

A set of 3D world coordinates.

Discussion

This method projects a ray from the camera’s location in the direction of the specified view coordinates, returning the world coordinates where that ray intersects a plane at a distance of 1.0 units (of world coordinate space) away from the camera.

See Also

Managing Camera Perspective