You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The trees are heaviliy optimized to make use of SIMD instructions.
42
+
The trees are heaviliy optimized to make use of SIMD instructions.
43
43
Therefore performance is best when used in burst compiled code.
44
44
45
-
Queries are *very* fast.
45
+
Queries are *very* fast.
46
46
The raycast never visits more nodes than absolutely neccessary.
47
47
The overlap (and insertion) use a technique where to test in which child nodes AABB's should go, only
48
48
two comparisons are made followed up by some bitwise operations. (See the source for an explanation).
49
49
50
50
Nearest neighbour is the slowest of the bunch (but still fast) as it has some overhead in keeping track of a priority queue.
51
51
52
52
Actual performance can vary wildly depending on the structure of your tree and it's
53
-
settings. For the sake of cool stats, here are some numbers on insertion times and raycasts for random points and AABB's,
53
+
settings. For the sake of cool stats, here are some numbers on insertion times and raycasts for random points and AABB's,
54
54
Single thread burst compiled, maxDepth of 8. These numbers should not be taken too seriously because it's random data
55
55
and the tree will be divided almost equally everywhere, which in most realistic scenarios is not the case.
56
56
@@ -74,6 +74,10 @@ There are two samples included that show how to use the octree and quadtree.
74
74
The extension classes provide readymade solutions for AABB only checking. For more complicated
75
75
shapes you must provide your own ray/overlap/distance calculations.
76
76
77
+
NOTE: If you've imported the package via the Unity Package Manager, you need to copy the
78
+
sample scenes to your Assets folder to open them.
79
+
[See this thread](https://forum.unity.com/threads/it-is-not-allowed-to-open-a-scene-in-a-read-only-package-why.1148036/)
80
+
77
81
### Insertion
78
82
The objects can be of any unmanaged type, when inserting, an AABB must be provided:
79
83
@@ -92,7 +96,6 @@ If you know your objects are points, you can insert them faster by using:
92
96
// Insert entities that are 'points'
93
97
for (int i = 0; i < entities.Length; i++)
94
98
{
95
-
var entity = entities[i];
96
99
octree.InsertPoint(entities[i], positions[i]);
97
100
}
98
101
@@ -197,10 +200,11 @@ A hashset can be used to only visit each object once.
197
200
198
201
### Support
199
202
Feel free to raise an issue or contact me for any questions.
200
-
The code is free to use in your project(s).
203
+
The code is free to use in your project(s).
201
204
If this was helpful to you, consider buying me a coffee ;)
202
205
203
-
https://ko-fi.com/bartofzo
206
+
<ahref='https://ko-fi.com/bartofzo'target='_blank'><imgheight='35'style='border:0px;height:46px;'src='https://az743702.vo.msecnd.net/cdn/kofi3.png?v=0'border='0'alt='Buy Me a Coffee at ko-fi.com' />
207
+
204
208
205
209
Thank you!
206
210
@@ -216,4 +220,4 @@ Nearest neighbour search:
216
220
https://stackoverflow.com/a/41306992
217
221
218
222
AnyPath, my pathfinding library on the Unity Asset store:
0 commit comments