Contents

pixelCast(from:to:)

Performs a ray cast against all the geometry in the scene for a ray between two end points.

Declaration

@MainActor @preconcurrency func pixelCast(from startPosition: SIMD3<Float>, to endPosition: SIMD3<Float>) async throws -> PixelCastHit?

Parameters

  • startPosition:

    The start position of the ray relative to the scene.

  • endPosition:

    The end position of the ray relative to the scene.

Return Value

A PixelCastHit. The hit indicates where the ray, starting at startPosition and ending at endPosition, hit a particular entity in the scene.

Discussion

The method ignores entities that lack a ModelComponent with a valid mesh.

See Also

Detecting intersections