Small World Engine API Reference - v0.76.20
    Preparing search index...

    Class SpatialHash

    A simple 2D spatial hash for fast broad-phase collision detection on the XZ plane. Useful for grid-based games like YAD where vertical checks are mostly irrelevant for walls.

    Index
    • Parameters

      • cellSize: number = 2

        The size of a single grid cell. E.g. if walls are 2 units, use 2.

      • tableSize: number = 4093

        The number of hash buckets. Use a prime number for fewer collisions.

      Returns SpatialHash

    cellSize: number
    • Queries for potential collisions along a ray on the XZ plane. This is a simple broad-phase approach stepping along the ray direction.

      Parameters

      Returns void