M2O Scripting APIScripting reference
    Preparing search index…
    Global objectClient API

    World

    World: {
        getGroundZ(
            x: number,
            y: number,
            z: number,
            maxDistance?: number,
        ): number | null;
    }

    Client-side queries against the currently streamed Mafia II world.

    Type Declaration

    • getGroundZ: function
      • Finds the closest ground surface below a world-space position using the game physics scene.

        Parameters

        • x: number

          World-space X coordinate of the ray origin.

        • y: number

          World-space Y coordinate of the ray origin.

        • z: number

          World-space Z coordinate from which to search downward.

        • OptionalmaxDistance: number

          Maximum downward probe distance in world units; defaults to 200.

        Returns number | null

        The ground Z coordinate, or null when no surface is found, physics is unavailable, or maxDistance is not positive.