navcat docs
    Preparing search index...

    Function raycastWithCosts

    • Casts a 'walkability' ray along the surface of the navigation mesh from the start position toward the end position, calculating accumulated path costs.

      This method is meant to be used for quick, short distance checks. The raycast ignores the y-value of the end position (2D check).

      Parameters

      • navMesh: NavMesh

        The navigation mesh to use for the raycast.

      • startNodeRef: number

        The NodeRef for the start polygon

      • startPosition: Vec3

        The starting position in world space.

      • endPosition: Vec3

        The ending position in world space.

      • filter: QueryFilter

        The query filter to apply.

      • prevRef: number

        The reference to the polygon we came from (for accurate cost calculations).

      Returns RaycastResult

      The raycast result with hit information, visited polygons, and accumulated path costs.