wave5-physics-world-singleton-queries

Run spatial queries against Unity Physics collision data via PhysicsWorldSingleton.

6|Updated Apr 2, 2026
One-click install
npx skills add https://github.com/dyCuong03/unity-agent-team --skill wave5-physics-world-singleton-queries
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wave5-physics-world-singleton-queries
Source: https://github.com/dyCuong03/unity-agent-team/tree/main/.claude/skills/unity-dots/wave5-physics-world-singleton-queries
Command: npx skills add https://github.com/dyCuong03/unity-agent-team --skill wave5-physics-world-singleton-queries

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the challenge of performing accurate runtime spatial queries in Unity DOTS by leveraging PhysicsWorldSingleton to query the current Unity Physics collision world.

Core Features & Use Cases

  • Raycast and collider cast: Determine closest hits or project shapes through the world for line-of-sight and impact prediction.
  • Distance and overlap queries: Find nearest bodies to a point and detect broad-phase AABB overlaps for targeting and area effects.
  • Correct scheduling and safety: Ensures dependencies are completed before reading PhysicsWorldSingleton and uses appropriate allocators for query results.

Use case example: Implement ground detection by casting a ray downward every simulation tick and reacting when the closest hit intersects the desired collision layer(s).

Quick Start

In your SimulationSystemGroup update, complete dependencies before reading PhysicsWorldSingleton, then schedule a job that uses PhysicsWorldSingleton.PhysicsWorld.CollisionWorld to run CastRay or OverlapAabb with a narrowed CollisionFilter.

Frequently Asked Questions about wave5-physics-world-singleton-queries

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run spatial queries against Unity Physics collision data in DOTS?

To run spatial queries against Unity Physics collision data, use PhysicsWorldSingleton to access the CollisionWorld for raycasts, shape casts, distance queries, and overlap checks after the physics world is built each tick.

What's the best way to schedule raycasts and overlap checks in Unity DOTS without causing job safety errors?

The best way to schedule raycasts safely is to complete dependencies before reading PhysicsWorldSingleton and allocate NativeList containers appropriately to store and dispose of query results without triggering job safety errors.

Why does my PhysicsWorldSingleton spatial query return stale or invalid collision results?

PhysicsWorldSingleton spatial queries return stale results if job dependencies are not completed before accessing the CollisionWorld, meaning you are querying the physics state before it is fully built for the current tick.

Can I use CollisionFilter to narrow down overlap checks and distance queries in Unity DOTS?

Yes, you can use CollisionFilter to narrow down overlap checks and distance queries by scheduling a job with PhysicsWorldSingleton.PhysicsWorld.CollisionWorld to target specific collision layers.

How do I implement ground detection using raycasts in a Unity DOTS simulation?

Implement ground detection by casting a ray downward every simulation tick and reacting when the closest hit intersects the desired collision layers, using PhysicsWorldSingleton to query the current CollisionWorld.

Does PhysicsWorldSingleton support broad-phase AABB overlap detection for area effects?

Yes, PhysicsWorldSingleton supports broad-phase AABB overlap detection for area effects by running OverlapAabb with a narrowed CollisionFilter against the current Unity Physics collision world.