瀏覽代碼

added parent traversal function to Object3d

unknown 10 年之前
父節點
當前提交
e06c50d128
共有 1 個文件被更改,包括 11 次插入0 次删除
  1. 11 0
      src/core/Object3D.js

+ 11 - 0
src/core/Object3D.js

@@ -527,6 +527,17 @@ THREE.Object3D.prototype = {
 
 	},
 
+	traverseParents: function ( callback ) {
+
+		if( this.parent ){
+		
+			callback( this.parent );
+		
+			this.parent.traverseParents( callback );
+		
+		}
+	},
+
 	updateMatrix: function () {
 
 		this.matrix.compose( this.position, this.quaternion, this.scale );