Function clampWorldPosition

  • Clamps a point to lie inside bounds along both axes.

    Parameters

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

      Position with x and y in world units.

      • x: number
      • y: number
    • bounds: WorldBounds

      Valid rectangle (minmax per axis).

    Returns {
        x: number;
        y: number;
    }

    Same point if inside, otherwise clamped to the nearest edge.

    • x: number
    • y: number

    Callers: server PlayWorld path enrichment; play-ui joystick and preview. Callees: Math.min/Math.max.