UNPKG

@rpgjs/physic

Version:

A deterministic 2D top-down physics library for RPG, sandbox and MMO games

72 lines 1.72 kB
import { Vector2 } from '../core/math/Vector2'; import { AABB } from '../core/math/AABB'; import { Entity } from '../physics/Entity'; import { Collider, CollisionInfo, ContactPoint } from './Collider'; import { Ray, RaycastHit } from './Ray'; /** * Circle collider implementation * * Represents a circular collision shape. * * @example * ```typescript * const entity = new Entity({ position: { x: 0, y: 0 }, radius: 10 }); * const collider = new CircleCollider(entity); * ``` */ export declare class CircleCollider implements Collider { private entity; /** * Creates a new circle collider * * @param entity - Entity this collider belongs to */ constructor(entity: Entity); /** * Gets the radius of the circle * * @returns Radius */ getRadius(): number; /** * Gets the center position of the circle * * @returns Center position */ getCenter(): Vector2; /** * @inheritdoc */ getBounds(): AABB; /** * @inheritdoc */ testCollision(other: Collider): CollisionInfo | null; /** * Tests collision with another circle * * @param other - Other circle collider * @returns Collision info or null */ private testCircleCircle; /** * Tests collision with an AABB * * @param other - AABB collider * @returns Collision info or null */ private testCircleAABB; /** * @inheritdoc */ getContactPoints(other: Collider): ContactPoint[]; /** * @inheritdoc */ getEntity(): Entity; /** * @inheritdoc */ raycast(ray: Ray): RaycastHit | null; } //# sourceMappingURL=CircleCollider.d.ts.map