Quick answer: Godot 4 ShapeCast3D in scenes with 1000+ physics bodies running slowly? Broad phase isn't optimal; reduce body count or use spatial hashing.

Combat scene: 1000 NPCs; line-of-sight cast costs 10ms.

Reduce body count

Distance-cull far bodies. Active count drops; broad phase fast.

Or use spatial hashing

Custom data structure for queries; bypasses physics for simple cases.

Profile broad phase

Physics profiler shows broad phase cost. Confirm bottleneck.

“Broad phase scales with body count. Reduce count for performance.”

If your physics queries are slow, the body count is the first suspect. Audit.

Related reading