@@ -144,7 +144,6 @@ module.exports.Component = registerComponent('oculus-touch-controls', {
144144 this . onThumbstickMoved = this . onThumbstickMoved . bind ( this ) ;
145145 this . onModelLoaded = this . onModelLoaded . bind ( this ) ;
146146 this . onControllersUpdate = this . onControllersUpdate . bind ( this ) ;
147- this . onControllerDisconnected = this . onControllerDisconnected . bind ( this ) ;
148147 this . checkIfControllerPresent = this . checkIfControllerPresent . bind ( this ) ;
149148 this . onAxisMoved = this . onAxisMoved . bind ( this ) ;
150149 } ,
@@ -188,6 +187,8 @@ module.exports.Component = registerComponent('oculus-touch-controls', {
188187 } ,
189188
190189 checkIfControllerPresent : function ( ) {
190+ var controllerObject3D = this . controllerObject3D ;
191+ if ( controllerObject3D ) { controllerObject3D . visible = false ; }
191192 checkControllerPresentAndSetup ( this , GAMEPAD_ID_PREFIX , {
192193 hand : this . data . hand ,
193194 iterateControllerProfiles : true
@@ -208,10 +209,11 @@ module.exports.Component = registerComponent('oculus-touch-controls', {
208209 var data = this . data ;
209210 var controllerId ;
210211 if ( ! data . model ) { return ; }
212+
211213 // If model has been already loaded
212214 if ( this . controllerObject3D ) {
213- this . el . setObject3D ( 'mesh' , this . controllerObject3D ) ;
214215 this . controllerObject3D . visible = true ;
216+ this . el . setObject3D ( 'mesh' , this . controllerObject3D ) ;
215217 return ;
216218 }
217219
@@ -252,21 +254,13 @@ module.exports.Component = registerComponent('oculus-touch-controls', {
252254
253255 addControllersUpdateListener : function ( ) {
254256 this . el . sceneEl . addEventListener ( 'controllersupdated' , this . onControllersUpdate , false ) ;
255- this . el . addEventListener ( 'controllerdisconnected' , this . onControllerDisconnected ) ;
256257 } ,
257258
258259 removeControllersUpdateListener : function ( ) {
259260 this . el . sceneEl . removeEventListener ( 'controllersupdated' , this . onControllersUpdate , false ) ;
260- this . el . removeEventListener ( 'controllerdisconnected' , this . onControllerDisconnected ) ;
261- } ,
262-
263- onControllerDisconnected : function ( ) {
264- if ( ! this . controllerObject3D ) { return ; }
265- this . controllerObject3D . visible = false ;
266261 } ,
267262
268263 onControllersUpdate : function ( ) {
269- // Note that due to gamepadconnected event propagation issues, we don't rely on events.
270264 this . checkIfControllerPresent ( ) ;
271265 } ,
272266
0 commit comments