Engine API Reference - v2.22.0-beta.0
    Preparing search index...

    Class WideLine

    A connected, variable-width line rendered by a WideLineRenderer. Point data is supplied using packed numeric arrays to avoid allocating an object for each point.

    A WideLine can belong to at most one WideLineRenderer. Removing it from the renderer leaves the WideLine intact, allowing it to be added to another renderer later.

    Index
    • get cap(): number

      Gets the cap style.

      Returns number

    • set cap(value: number): void

      The cap style. Can be LINECAP_BUTT, LINECAP_SQUARE or LINECAP_ROUND. The style also applies to the ends of visible dashes. Defaults to LINECAP_BUTT.

      Parameters

      • value: number

      Returns void

    • get closed(): boolean

      Gets whether the last point connects back to the first point.

      Returns boolean

    • set closed(value: boolean): void

      Whether the last point connects back to the first point. Defaults to false.

      Parameters

      • value: boolean

      Returns void

    • get dashLength(): number

      Gets the length of each visible dash in world units.

      Returns number

    • set dashLength(value: number): void

      The length of each visible dash in world units. A value of zero makes the line solid. Defaults to zero.

      Parameters

      • value: number

      Returns void

    • get dashOffset(): number

      Gets the offset of the dash pattern in world units.

      Returns number

    • set dashOffset(value: number): void

      Offset of the dash pattern in world units. Defaults to zero.

      Parameters

      • value: number

      Returns void

    • get gapLength(): number

      Gets the length of each gap in world units.

      Returns number

    • set gapLength(value: number): void

      The length of each gap in world units. A value of zero makes the line solid. Defaults to zero.

      Parameters

      • value: number

      Returns void

    • get join(): number

      Gets the join style.

      Returns number

    • set join(value: number): void

      The join style. Can be LINEJOIN_MITER, LINEJOIN_BEVEL or LINEJOIN_ROUND. Defaults to LINEJOIN_MITER.

      Parameters

      • value: number

      Returns void

    • get pointCount(): number

      The number of points in the line. This is zero until WideLine#set is called.

      Returns number

    • get renderer(): WideLineRenderer | null

      The renderer that owns this line, or null when the line is not being rendered.

      Returns WideLineRenderer | null

    • Atomically replaces all point data. This is the only operation that can change the number of points. The colors and widths can each be supplied either per point or as a single uniform value.

      Parameters

      • positions: ArrayLike<number>

        Packed xyz coordinates. The length must be a multiple of three and contain at least two points.

      • Optionalcolors: ArrayLike<number> | Color = Color.WHITE

        Packed rgb values with one color per point, or a single color used by every point. The alpha component of a Color is ignored.

      • Optionalwidths: number | ArrayLike<number> = 1

        One width per point, or a single width used by every point. Width units are selected by the owning WideLineRenderer and values must be non-negative.

      Returns WideLine

      This line.

    • Replaces colors without changing the number of points.

      Parameters

      • colors: ArrayLike<number> | Color

        Packed rgb values containing exactly pointCount * 3 values, or a single color used by every point. The alpha component of a Color is ignored.

      Returns WideLine

      This line.

    • Replaces positions without changing the number of points.

      Parameters

      • positions: ArrayLike<number>

        Packed xyz coordinates containing exactly pointCount * 3 values.

      Returns WideLine

      This line.

    • Replaces widths without changing the number of points.

      Parameters

      • widths: number | ArrayLike<number>

        An array containing exactly pointCount values, or a single width used by every point. Width units are selected by the owning WideLineRenderer and values must be non-negative.

      Returns WideLine

      This line.