Prechádzať zdrojové kódy

Merge pull request #5658 from Verold/ParentTraverse

Added parent traversal function to Object3d
Mr.doob 10 rokov pred
rodič
commit
50688132ff
1 zmenil súbory, kde vykonal 12 pridanie a 0 odobranie
  1. 12 0
      src/core/Object3D.js

+ 12 - 0
src/core/Object3D.js

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