Contents

pixelCast(origin:direction:length:)

Performs a ray cast against all the geometry in the scene for a ray of a given origin, direction, and length.

Declaration

@MainActor @preconcurrency func pixelCast(origin: SIMD3<Float>, direction: SIMD3<Float>, length: Float = 100) async throws -> PixelCastHit?

Parameters

  • origin:

    The origin of the ray relative to the scene.

  • direction:

    The direction of the ray relative to the scene.

  • length:

    The length of the ray relative to the scene.

Return Value

A PixelCastHit. The hit indicates where the ray, starting at a given point and traveling in a given direction, hit a particular entity in the scene.

Discussion

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

See Also

Detecting intersections