clik-engine API
    Preparing search index...

    Class ContinuousCollision

    Swept AABB collision detection.

    Usage:

    const result = ContinuousCollision.sweep(
    { x: 10, y: 10, width: 4, height: 12 }, // moving box
    { x: 0, y: -600 * dt }, // velocity this frame
    { x: 50, y: 0, width: 100, height: 10 }, // static obstacle
    );
    if (result.hit) {
    // Move only to t * velocity, then slide
    }
    Index

    Constructors

    Methods

    • Resolve position after sweep: move to contact point and slide along surface.

      Parameters

      • position: { x: number; y: number }
      • velocity: { x: number; y: number }
      • result: SweptResult

      Returns { vx: number; vy: number; x: number; y: number }