Browse Source

added parent traversal function to Object3d

unknown 10 years ago
parent
commit
e06c50d128
1 changed files with 11 additions and 0 deletions
  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 () {
 	updateMatrix: function () {
 
 
 		this.matrix.compose( this.position, this.quaternion, this.scale );
 		this.matrix.compose( this.position, this.quaternion, this.scale );