Instance Method

unproject(_:ontoPlane:)

Maps a 2D point from the view’s coordinate system onto the given plane in 3D space.

Declaration

func unproject(_ point: CGPoint, ontoPlane planeTransform: float4x4) -> SIMD3<Float>?

Parameters

point

The point in the view’s coordinate system.

planeTransform

A transform used to define the coordinate system of the plane. The positive Y axis is taken as the normal of the plane.

Return Value

The 3D position in world coordinates, or nil if the mapping isn’t possible.

See Also

Mapping Between Coordinate Spaces

func project(SIMD3<Float>) -> CGPoint?

Projects a point from the 3D world coordinate system of the scene to the 2D pixel coordinate system of the view.

func unproject(CGPoint, viewport: CGRect) -> SIMD3<Float>?

Maps a 2D point from the pixel coordinate system of a viewport into a 3D coordinate space.

func ray(through: CGPoint) -> (origin: SIMD3<Float>, direction: SIMD3<Float>)?

Determines the position and direction of a ray through the given point in the 2D space of the view.