@rpgjs/physic
Version:
A deterministic 2D top-down physics library for RPG, sandbox and MMO games
54 lines • 1.35 kB
TypeScript
import { AABB } from '../core/math/AABB';
import { Entity } from '../physics/Entity';
import { Collider, CollisionInfo, ContactPoint } from './Collider';
import { Ray, RaycastHit } from './Ray';
/**
* AABB (Axis-Aligned Bounding Box) collider implementation
*
* Represents a rectangular collision shape aligned with the axes.
*
* @example
* ```typescript
* const entity = new Entity({ position: { x: 0, y: 0 }, width: 10, height: 10 });
* const collider = new AABBCollider(entity);
* ```
*/
export declare class AABBCollider implements Collider {
private entity;
/**
* Creates a new AABB collider
*
* @param entity - Entity this collider belongs to
*/
constructor(entity: Entity);
/**
* Gets the AABB bounds
*
* @returns AABB
*/
getBounds(): AABB;
/**
* @inheritdoc
*/
testCollision(other: Collider): CollisionInfo | null;
/**
* Tests collision with another AABB
*
* @param other - Other AABB collider
* @returns Collision info or null
*/
private testAABBAABB;
/**
* @inheritdoc
*/
getContactPoints(other: Collider): ContactPoint[];
/**
* @inheritdoc
*/
getEntity(): Entity;
/**
* @inheritdoc
*/
raycast(ray: Ray): RaycastHit | null;
}
//# sourceMappingURL=AABBCollider.d.ts.map