Black Trigram (흑괘) - Korean Martial Arts Combat Simulator API - v0.7.53
    Preparing search index...

    Function clampToArenaBounds

    • Clamp a 2D position to stay within arena boundaries in meters.

      Works in projected 2D arena space where:

      • position.x → world X (horizontal)
      • position.y → world Z (depth)

      Parameters

      • position: { x: number; y: number }

        2D projected position in meters (may exceed arena bounds)

      • bounds: PhysicsArenaBounds

        Arena bounds with meter dimensions

      Returns { x: number; y: number }

      Position clamped to arena boundaries

      const bounds = { worldWidthMeters: 10, worldDepthMeters: 7.5, ... };
      const position = { x: 6, y: 4 }; // Outside arena
      const clamped = clampToArenaBounds(position, bounds);
      // Result: { x: 5, y: 3.75 }