@@ -108,38 +108,35 @@ AFRAME.registerComponent("super-spawner", {
108108 this . heldEntities . clear ( ) ;
109109 } ,
110110
111- onSpawnEvent : ( ( ) => {
112- const spawnOffset = new THREE . Vector3 ( ) ;
113- return async function ( ) {
114- const controllerCount = this . el . sceneEl . components [ "input-configurator" ] . controllerQueue . length ;
115- const using6DOF = controllerCount > 1 && this . el . sceneEl . is ( "vr-mode" ) ;
116- const hand = using6DOF ? this . data . superHand : this . data . cursorSuperHand ;
117-
118- if ( this . cooldownTimeout || ! hand ) {
119- return ;
120- }
111+ async onSpawnEvent ( ) {
112+ const controllerCount = this . el . sceneEl . components [ "input-configurator" ] . controllerQueue . length ;
113+ const using6DOF = controllerCount > 1 && this . el . sceneEl . is ( "vr-mode" ) ;
114+ const hand = using6DOF ? this . data . superHand : this . data . cursorSuperHand ;
121115
122- const entity = addMedia ( this . data . src , this . data . template , ObjectContentOrigins . SPAWNER ) . entity ;
116+ if ( this . cooldownTimeout || ! hand ) {
117+ return ;
118+ }
123119
124- hand . object3D . getWorldPosition ( entity . object3D . position ) ;
125- hand . object3D . getWorldQuaternion ( entity . object3D . quaternion ) ;
126- if ( this . data . useCustomSpawnScale ) {
127- entity . object3D . scale . copy ( this . data . spawnScale ) ;
128- }
120+ const entity = addMedia ( this . data . src , this . data . template , ObjectContentOrigins . SPAWNER ) . entity ;
129121
130- this . activateCooldown ( ) ;
122+ hand . object3D . getWorldPosition ( entity . object3D . position ) ;
123+ hand . object3D . getWorldQuaternion ( entity . object3D . quaternion ) ;
124+ if ( this . data . useCustomSpawnScale ) {
125+ entity . object3D . scale . copy ( this . data . spawnScale ) ;
126+ }
131127
132- await waitForEvent ( "body-loaded" , entity ) ;
128+ this . activateCooldown ( ) ;
133129
134- hand . object3D . getWorldPosition ( entity . object3D . position ) ;
130+ await waitForEvent ( "body-loaded" , entity ) ;
131+
132+ hand . object3D . getWorldPosition ( entity . object3D . position ) ;
135133
136- if ( ! using6DOF ) {
137- for ( let i = 0 ; i < this . data . grabEvents . length ; i ++ ) {
138- hand . emit ( this . data . grabEvents [ i ] , { targetEntity : entity } ) ;
139- }
134+ if ( ! using6DOF ) {
135+ for ( let i = 0 ; i < this . data . grabEvents . length ; i ++ ) {
136+ hand . emit ( this . data . grabEvents [ i ] , { targetEntity : entity } ) ;
140137 }
141- } ;
142- } ) ( ) ,
138+ }
139+ } ,
143140
144141 async onGrabStart ( e ) {
145142 if ( this . cooldownTimeout ) {
0 commit comments