NativeOctree
ForkNative Octree for Unity DOTS provides an efficient spatial partitioning solution as a native collection. Store and query point data with associated radii using fast bulk insertion via morton codes, with support for raycasting, sphere queries, and dynamic bounds resizing. Designed for high-performance job-compatible workflows with proven stability across multiple projects.
Unity Project
Built with Unity 2022.3.5f1 · download the source from GitHub

Dependencies (43)
Unity UI 1.0.0Entities 1.0.11Timeline 1.7.5JetBrains Rider Editor 3.0.24VS Code Editor 1.2.5AI 1.0.0UI 1.0.0VR 1.0.0XR 1.0.0Collections 1.2.4TextMeshPro 3.0.6Wind 1.0.0AI Navigation 1.1.4Audio 1.0.0Cloth 1.0.0IMGUI 1.0.0Umbra 1.0.0Video 1.0.0Test Framework 1.1.33Physics 1.0.0Terrain 1.0.0Tilemap 1.0.0Visual Scripting 1.8.0Visual Studio Editor 2.0.18Director 1.0.0Vehicles 1.0.0Animation 1.0.0Physics 2D 1.0.0com.unity.modules.androidjni 1.0.0UI Elements 1.0.0com.unity.feature.development 1.0.1Asset Bundle 1.0.0JSON Serialize 1.0.0Screen Capture 1.0.0Particle System 1.0.0Terrain Physics 1.0.0Unity Analytics 1.0.0Image Conversion 1.0.0Unity Web Request 1.0.0Unity Web Request WWW 1.0.0Unity Web Request Audio 1.0.0Unity Web Request Texture 1.0.0Unity Web Request Asset Bundle 1.0.0
README
Native Octree
An Octree Native Collection for Unity DOTS. Changes & improvements:
- Added automatic bounds resizing;
- Added more queries into the tree -> RaycastNonSorted & SphereQuery (approximate) SphereCast as AABB;
- Updated to Unity v2022.3 LTS & Entities 1.0.11;
- Incompatible with original repo due to current & potential future changes. Remove before replacing old one and vice versa.
Implementation
- It's a DOTS native container, meaning it's handling its own unmanaged memory and can be passed into jobs!
- Supports the storing of point + respective element radius
- The bulk insertion is using morton codes. This allows very fast bulk insertion but causes an increasing (minor) overhead with an increased depth
Stability
- Basic performance tests included.
- Tested on multiple projects over 3+ years, no major issues so far. If in doubt - write more tests.
- Performance tests are available via Test Runner.
Potential future work / missing features
- More unit tests
- Support for other basic shapes & queries
- Support individual adding and removing of elements
Forked from https://github.com/marijnz/NativeQuadtree.
Comments
No comments yet. Be the first!
Sign in to join the conversation
Sign In