RSX Code Reference
    Preparing search index...

    Class Ray2

    The Ray2 implements a line in 2D space represented with an origin and direction. The class follows the 'copy-on-write' pattern, which means that mutable operations return a copy of the line with updates values. It also implies that the values of the line cannot be directly modified.

    The concept of immutability improves sharing of objects as all types in TypeScript are assigned by identity, instead of by-value (e.g. a copy) as in other programming languages like C.

    Index
    direction: Vector2

    The direction of the line.

    origin: Vector2

    The origin of the line.

    • Line/Line intersection, returns boolean result and distance to intersection point.

      Parameters

      Returns number

      The intersection T if intersected, or -1 if not intersected.