Browse Source

Merge pull request #5658 from Verold/ParentTraverse

Added parent traversal function to Object3d
Mr.doob 10 năm trước cách đây
mục cha
commit
50688132ff
1 tập tin đã thay đổi với 12 bổ sung0 xóa
  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 () {
 
 		this.matrix.compose( this.position, this.quaternion, this.scale );