Przeglądaj źródła

add getDescendants to Object3D

libra guest 13 lat temu
rodzic
commit
8a960ad7fd
1 zmienionych plików z 17 dodań i 0 usunięć
  1. 17 0
      src/core/Object3D.js

+ 17 - 0
src/core/Object3D.js

@@ -206,6 +206,23 @@ THREE.Object3D.prototype = {
 		return undefined;
 
 	},
+	
+	getDescendants: function (returnValue) {
+		var children = this.children,l = children.length,child;
+		
+		if (returnValue === undefined){
+			returnValue = [];	
+		}
+		
+		for (var i = 0; i < l ; i++){
+			child = children[i];
+			returnValue.push(child);
+			child.getDescendants(returnValue);
+		};
+		
+		return returnValue;
+		
+	},
 
 	updateMatrix: function () {