File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,21 @@ var AmmoShape = {
3838 multiple : true ,
3939
4040 init : function ( ) {
41+ if ( this . data . fit !== FIT . MANUAL ) {
42+ if ( this . el . object3DMap . mesh ) {
43+ this . mesh = this . el . object3DMap . mesh ;
44+ } else {
45+ const self = this ;
46+ this . el . addEventListener ( "object3dset" , function ( e ) {
47+ if ( e . detail . type === "mesh" ) {
48+ self . init ( ) ;
49+ }
50+ } ) ;
51+ console . log ( "Cannot use FIT.ALL without object3DMap.mesh. Waiting for it to be set." ) ;
52+ return ;
53+ }
54+ }
55+
4156 this . system = this . el . sceneEl . systems . physics ;
4257 this . collisionShapes = [ ] ;
4358
@@ -53,13 +68,6 @@ var AmmoShape = {
5368 console . warn ( "body not found" ) ;
5469 return ;
5570 }
56- if ( this . data . fit !== FIT . MANUAL ) {
57- if ( ! this . el . object3DMap . mesh ) {
58- console . error ( "Cannot use FIT.ALL without object3DMap.mesh" ) ;
59- return ;
60- }
61- this . mesh = this . el . object3DMap . mesh ;
62- }
6371 this . body . addShapeComponent ( this ) ;
6472 } ,
6573
You can’t perform that action at this time.
0 commit comments