Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/excaliburjs/Excalibur. 🎮 Your friendly TypeScript 2D game engine for the web 🗡️ excaliburjs.com
excalibur excaliburjs game-development game-engine game-framework gamedev games html5-canvas typescript
Something went wrong. Try again.
TypeScript
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970import type { FrameStats } from '../../debug';import type { Pair } from './pair';import type { Collider } from '../colliders/collider';import type { CollisionContact } from './collision-contact';import type { RayCastOptions } from './ray-cast-options';import type { Ray } from '../../math/ray';import type { RayCastHit } from './ray-cast-hit';import type { ExcaliburGraphicsContext } from '../../graphics/context/excalibur-graphics-context';import type { BoundingBox } from '../bounding-box';import type { Vector } from '../../math/vector';
/** * Definition for collision processor * * Collision processors are responsible for tracking colliders and identifying contacts between them */export interface CollisionProcessor { /** * */ rayCast(ray: Ray, options?: RayCastOptions): RayCastHit[];
/** * Query the collision processor for colliders that contain the point * @param point */ query(point: Vector): Collider[];
/** * Query the collision processor for colliders that overlap with the bounds * @param bounds */ query(bounds: BoundingBox): Collider[];
/** * Get all tracked colliders */ getColliders(): readonly Collider[];
/** * Track collider in collision processor */ track(target: Collider): void;
/** * Untrack collider in collision processor */ untrack(target: Collider): void;
/** * Detect potential collision pairs given a list of colliders */ broadphase(targets: Collider[], elapsed: number, stats?: FrameStats): Pair[];
/** * Identify actual collisions from those pairs, and calculate collision impulse */ narrowphase(pairs: Pair[], stats?: FrameStats): CollisionContact[];
/** * Update the internal structures to track colliders */ update(targets: Collider[], elapsed: number): number;
/** * Draw any debug information */ debug(ex: ExcaliburGraphicsContext, elapsed: number): void;}