Browse Source

Add decal as child of mesh (#29486)

WestLangley 1 năm trước cách đây
mục cha
commit
84697cca86
1 tập tin đã thay đổi với 4 bổ sung3 xóa
  1. 4 3
      examples/webgl_decals.html

+ 4 - 3
examples/webgl_decals.html

@@ -245,7 +245,7 @@
 					} );
 					} );
 
 
 					scene.add( mesh );
 					scene.add( mesh );
-					mesh.scale.set( 10, 10, 10 );
+					mesh.scale.multiplyScalar( 10 );
 
 
 				} );
 				} );
 
 
@@ -268,7 +268,8 @@
 				m.renderOrder = decals.length; // give decals a fixed render order
 				m.renderOrder = decals.length; // give decals a fixed render order
 
 
 				decals.push( m );
 				decals.push( m );
-				scene.add( m );
+
+				mesh.attach( m );
 
 
 			}
 			}
 
 
@@ -276,7 +277,7 @@
 
 
 				decals.forEach( function ( d ) {
 				decals.forEach( function ( d ) {
 
 
-					scene.remove( d );
+					mesh.remove( d );
 
 
 				} );
 				} );
 
 

粤ICP备19079148号