Get all adjacent objects to a given object in 3D array?
Okay, so I have a 3D array [12,12,12] how would I go about getting all the objects adjacent to a given object in the grid. I need this for the A* algorithm.
Watch out for edge of map endcases ......
Even more fun with 6 clip planes logic instead of 4 ......
--------------------------------------------[size="1"]Ratings are Opinion, not Fact
12x12x12... just brute force it. When you get to around 104 entries you might need to use a spatial decomposition for an efficient search (such as a nearest neighbour search on a k-d tree)... but for such a small matrix, brute force will always be faster, since you don't waste time building the decomposition (but lose time on the search).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement