@rpgjs/physic
Version:
A deterministic 2D top-down physics library for RPG, sandbox and MMO games
24 lines • 888 B
TypeScript
import { AABB } from '../core/math/AABB';
import { Entity } from '../physics/Entity';
import { SpatialPartition } from '../world/SpatialPartition';
import { Ray, RaycastHit } from './Ray';
/**
* Simple BVH spatial partition (rebuild-on-update)
*
* Not a dynamic tree; we rebuild the entire hierarchy when entities change.
* Suitable for medium sized scenes; keeps API parity with `SpatialPartition`.
*/
export declare class BVH implements SpatialPartition {
private entities;
private root;
clear(): void;
insert(entity: Entity): void;
remove(entity: Entity): void;
update(entity: Entity): void;
query(entity: Entity): Set<Entity>;
queryAABB(bounds: AABB): Set<Entity>;
raycast(ray: Ray, mask?: number, filter?: (entity: Entity) => boolean): RaycastHit | null;
private queryAABBInternal;
private rebuild;
}
//# sourceMappingURL=bvh.d.ts.map