UNPKG

@rpgjs/physic

Version:

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

36 lines 1.58 kB
import { PhysicsEngine } from '../../api/PhysicsEngine'; import { Entity } from '../../physics/Entity'; import { MovementBody, MovementStrategy } from '../MovementStrategy'; /** * Seeks a moving target while avoiding nearby obstacles. * * The strategy combines a pull towards the target with repulsive forces from * close entities, creating smooth avoidance behaviour. * * @example * ```typescript * const seek = new SeekAvoid(engine, () => playerEntity, 3, 2, 6, 0.5); * movementManager.add(enemy, seek); * ``` */ export declare class SeekAvoid implements MovementStrategy { private readonly engine; private readonly targetProvider; private maxSpeed; private repulseRadius; private repulseWeight; private repulseRadiusSq; private arriveRadiusSq; /** * @param engine - Physics engine used for spatial queries * @param targetProvider - Function returning the target entity (or null) * @param maxSpeed - Maximum speed in units per second * @param repulseRadius - Radius in which obstacles apply repulsion * @param repulseWeight - Strength of the repulsion force * @param arriveRadius - Distance considered as arrival */ constructor(engine: PhysicsEngine, targetProvider: () => Entity | null | undefined, maxSpeed?: number, repulseRadius?: number, repulseWeight?: number, arriveRadius?: number); update(body: MovementBody, _dt: number): void; setParameters(maxSpeed?: number, repulseRadius?: number, repulseWeight?: number, arriveRadius?: number): void; } //# sourceMappingURL=SeekAvoid.d.ts.map