@rpgjs/physic
Version:
A deterministic 2D top-down physics library for RPG, sandbox and MMO games
42 lines • 1.1 kB
TypeScript
import { Vector2 } from '../core/math/Vector2';
import { Entity } from '../physics/Entity';
/**
* Raycast hit information
*/
export interface RaycastHit {
/** Entity hit by the ray */
entity: Entity;
/** Point of intersection */
point: Vector2;
/** Normal at the point of intersection */
normal: Vector2;
/** Distance from ray origin to intersection point */
distance: number;
}
/**
* Ray for raycasting
*/
export declare class Ray {
/** Ray origin */
origin: Vector2;
/** Ray direction (normalized) */
direction: Vector2;
/** Maximum length of the ray */
length: number;
/**
* Creates a new ray
*
* @param origin - Ray origin
* @param direction - Ray direction
* @param length - Maximum length (default: Infinity)
*/
constructor(origin: Vector2, direction: Vector2, length?: number);
/**
* Gets a point along the ray
*
* @param distance - Distance from origin
* @returns Point at distance
*/
getPoint(distance: number): Vector2;
}
//# sourceMappingURL=Ray.d.ts.map