blaze-2d
Version:
A fast and simple WebGL 2 2D game engine written in TypeScript
32 lines (31 loc) • 837 B
TypeScript
import { vec2 } from "gl-matrix";
import LineCollider from "./collider/line";
/**
* Represents a ray that can be used for raycasting.
*
* A {@link Ray} is really a {@link LineCollider} with a weight of `Physics.G_CONF.POINT_SIZE`.
*/
export default class Ray extends LineCollider {
private direction;
private length;
/**
* Create a {@link Ray}.
*
* @param origin The ray's starting position
* @param direction The direction of the ray
* @param length The length of the ray
*/
constructor(origin: vec2, direction: vec2, length: number);
/**
* Gets the direction of the ray.
*
* @returns The direction of the ray
*/
getDirection(): vec2;
/**
* Gets the length of the ray.
*
* @returns The length of the ray
*/
getLength(): number;
}