Skip to content

Commit f6d18bf

Browse files
Check for objects in any children, not just root node
1 parent 55e5397 commit f6d18bf

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

Scripts/BoundsOctree.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ void Grow(Vector3 direction) {
244244
// Create a new, bigger octree root node
245245
rootNode = new BoundsOctreeNode<T>(newLength, minSize, looseness, newCenter);
246246

247-
if (oldRoot.Count > 0)
247+
if (oldRoot.HasAnyObjects())
248248
{
249249
// Create 7 new octree children to go with the old root as children of the new root
250250
int rootPos = GetRootPosIndex(xDirection, yDirection, zDirection);

Scripts/BoundsOctreeNode.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ public class BoundsOctreeNode<T> {
99
// Length of this node if it has a looseness of 1.0
1010
public float BaseLength { get; private set; }
1111

12-
public float Count { get { return objects.Count; } }
13-
1412
// Looseness value for this node
1513
float looseness;
1614
// Minimum size for a node in this octree
@@ -526,7 +524,7 @@ bool ShouldMerge() {
526524
/// Checks if this node or anything below it has something in it.
527525
/// </summary>
528526
/// <returns>True if this node or any of its children, grandchildren etc have something in them</returns>
529-
bool HasAnyObjects() {
527+
public bool HasAnyObjects() {
530528
if (objects.Count > 0) return true;
531529

532530
if (children != null) {

0 commit comments

Comments
 (0)