← All resources

Using grid to speed up dynamic collisions

Blog Intermediate

Jan Mróz

Proposed by Jan Mróz

Visit resource ↗

Description

Jan Mróz's May 2026 case study on Procedural Pixels optimizes broad-phase work in his Burst-compiled Verlet solver used during a game jam with about one thousand dynamic objects.

After profiling naive O(n squared) dynamic collision iterations, he adds a sparse UnsafeParallelMultiHashMap grid keyed by cell coordinates, rebuilds it each step with parallel jobs, and queries four neighboring cells per object when cell size exceeds object diameter.

Intermediate Unity developers writing performance-focused simulation code in unmanaged containers will follow the article best; it assumes familiarity with Jobs, Burst, and the solver pipeline described in earlier posts.

The write-up includes profiler tables showing roughly 3.7x to 69x speedups at 1000 to 10000 bodies and discusses gameplay uses beyond physics such as proximity queries on flat worlds.

It complements the Verlet introduction and grid pattern articles as a concrete optimization walkthrough on the same custom engine.