Browse Source

Extends HierarchicalWorld chunk bounds so objects can predict their levels using only position and their own bounds.

clementlandrin 1 year ago
parent
commit
006cc31db7
1 changed files with 4 additions and 4 deletions
  1. 4 4
      h3d/scene/HierarchicalWorld.hx

+ 4 - 4
h3d/scene/HierarchicalWorld.hx

@@ -74,11 +74,11 @@ class HierarchicalWorld extends Object {
 		this.y = data.y;
 		calcAbsPos();
 		bounds = new h3d.col.Bounds();
-		var halfSize = data.size >> 1;
-		// TBD : z bounds? Negative & positive infinity causes bounds to break.
+		// TBD : z bounds? Negative & positive infinity causes debug bounds bugs.
+		// bounds is twice larger than needed so object chunks can be predicted using position and bounds only
 		var pseudoInfinity = 1e10;
-		bounds.addPoint(new h3d.col.Point(-halfSize, -halfSize, -pseudoInfinity));
-		bounds.addPoint(new h3d.col.Point(halfSize,halfSize, pseudoInfinity));
+		bounds.addPoint(new h3d.col.Point(-data.size, -data.size, -pseudoInfinity));
+		bounds.addPoint(new h3d.col.Point(data.size,data.size, pseudoInfinity));
 		bounds.transform(absPos);
 
 		if ( data.depth == 0 ) {