Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Ray

A 2D ray that can be cast into the scene to do collision detection

Hierarchy

  • Ray

Index

Constructors

Properties

Methods

Constructors

constructor

  • Parameters

    • pos: Vector

      The starting position for the ray

    • dir: Vector

      The vector indicating the direction of the ray

    Returns Ray

Properties

dir

dir: Vector

pos

pos: Vector

Methods

getPoint

  • getPoint(time: number): Vector
  • Returns the point of intersection given the intersection time

    Parameters

    • time: number

    Returns Vector

intersect

  • intersect(line: Line): number
  • Tests a whether this ray intersects with a line segment. Returns a number greater than or equal to 0 on success. This number indicates the mathematical intersection time.

    Parameters

    • line: Line

      The line to test

    Returns number