import Vector2 from '../math/Vector2.js'; import GameObject from '../core/GameObject.js'; /** * Holds data about a collision between two objects. */ export interface CollisionManifold { /** First object in the collision. */ obj1: GameObject; /** Second object in the collision. */ obj2: GameObject; /** Normalized direction of the collision from obj1 to obj2. */ normal: Vector2; /** Penetration depth in world space. */ depth: number; } /** * Utility class for collision detection between game objects. */ export default class Physics { /** * Checks if two game objects are colliding. * @param obj1 First object. * @param obj2 Second object. * @returns A manifold if colliding, else null. */ static getCollisionManifold(obj1: GameObject, obj2: GameObject): CollisionManifold | null; private static circleVsCircle; private static aabbVsAabb; private static circleVsRect; /** * Checks if two game objects are colliding and resolves it. * @param obj1 First object. * @param obj2 Second object. * @returns True if the objects were colliding. */ static checkCollision(obj1: GameObject, obj2: GameObject): boolean; private static resolveCollision; }