Instance Method

rayTo:forViewPort:

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

Declaration

- (vector_float3)rayTo:(vector_int2)pixel forViewPort:(vector_int2)size;

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

projectionMatrix

A transformation matrix that determines the extent of a scene visible to the camera.

projection

The style of projection transform used by the camera.

MDLCameraProjection

Options for camera projection styles, used by the projection property.

nearVisibilityDistance

The camera's near depth limit.

farVisibilityDistance

The camera’s far depth limit.

fieldOfView

The camera’s field of view, in degrees.

worldToMetersConversionScale

The scale factor to meters from the world coordinate system containing the camera.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software