void LateUpdate() { if (Container) { CurrentNode = Container.Tree.Update(this, CurrentNode, transform.position); } }
void Update() { if (Container) { // Debug the octree //Verify(); CurrentNode = Container.Tree.Update(this, CurrentNode, transform.position); } }
public OctreeNode(SparseOctree <T> tree, OctreeNode parent, Bounds b) { NodeBounds = b; Tree = tree; Parent = parent; if (parent == null) { Depth = 0; } else { Depth = parent.Depth + 1; } }
bool RecursiveVerify(HashSet <SparseOctree <OctreeElementComponent> .OctreeNode> set, SparseOctree <OctreeElementComponent> .OctreeNode node) { if (set.Contains(node) != node.Contained.Contains(this)) { Debug.LogError("ERROR: Octree contained mismatch! Failed with node @ " + node.NodeBounds); return(false); } if (node.Divisions != null) { for (int z = 0; z < 2; ++z) { for (int y = 0; y < 2; ++y) { for (int x = 0; x < 2; ++x) { if (!RecursiveVerify(set, node.Divisions[x, y, z])) { return(false); } } } } } return(true); }
void Awake() { Tree = new SparseOctree <OctreeElementComponent>(OctreeBounds, Depth); }