Browse Source

WebVRManager: Fix spurious events on the first update of the VR controllers.

jayd 6 năm trước cách đây
mục cha
commit
9b062a5e84
1 tập tin đã thay đổi với 2 bổ sung0 xóa
  1. 2 0
      src/renderers/webvr/WebVRManager.js

+ 2 - 0
src/renderers/webvr/WebVRManager.js

@@ -153,6 +153,8 @@ function WebVRManager( renderer ) {
 
 				var buttonId = gamepad.id === 'Daydream Controller' ? 0 : 1;
 
+				if ( triggers[ i ] === undefined ) triggers[ i ] = false;
+
 				if ( triggers[ i ] !== gamepad.buttons[ buttonId ].pressed ) {
 
 					triggers[ i ] = gamepad.buttons[ buttonId ].pressed;