@@ -35,9 +35,9 @@ AFRAME.registerComponent('model-viewer', {
35
35
36
36
this . onOrientationChange = this . onOrientationChange . bind ( this ) ;
37
37
38
+ this . initCameraRig ( ) ;
38
39
this . initEntities ( ) ;
39
40
this . initBackground ( ) ;
40
- this . initCameraRig ( ) ;
41
41
42
42
if ( this . data . uploadUIEnabled ) { this . initUploadInput ( ) ; }
43
43
@@ -212,6 +212,8 @@ AFRAME.registerComponent('model-viewer', {
212
212
intensity : 1
213
213
} ) ;
214
214
215
+ modelPivotEl . id = 'modelPivot' ;
216
+
215
217
this . el . appendChild ( sceneLightEl ) ;
216
218
217
219
reticleEl . setAttribute ( 'gltf-model' , '#reticle' ) ;
@@ -258,6 +260,7 @@ AFRAME.registerComponent('model-viewer', {
258
260
259
261
this . containerEl . appendChild ( titleEl ) ;
260
262
263
+ lightEl . id = 'light' ;
261
264
lightEl . setAttribute ( 'position' , '-2 4 2' ) ;
262
265
lightEl . setAttribute ( 'light' , {
263
266
type : 'directional' ,
@@ -276,6 +279,7 @@ AFRAME.registerComponent('model-viewer', {
276
279
this . containerEl . appendChild ( modelPivotEl ) ;
277
280
278
281
this . el . appendChild ( containerEl ) ;
282
+ this . el . appendChild ( reticleEl ) ;
279
283
} ,
280
284
281
285
onThumbstickMoved : function ( evt ) {
@@ -354,15 +358,20 @@ AFRAME.registerComponent('model-viewer', {
354
358
this . cameraRigPosition = cameraRigEl . object3D . position . clone ( ) ;
355
359
this . cameraRigRotation = cameraRigEl . object3D . rotation . clone ( ) ;
356
360
357
- cameraRigEl . object3D . rotation . set ( 0 , 0 , 0 ) ;
358
- cameraRigEl . object3D . position . set ( 0 , 0 , 2 ) ;
361
+ if ( ! this . el . sceneEl . is ( 'ar-mode' ) ) {
362
+ cameraRigEl . object3D . position . set ( 0 , 0 , 2 ) ;
363
+ } else {
364
+ cameraRigEl . object3D . position . set ( 0 , 0 , 0 ) ;
365
+ }
359
366
} ,
360
367
361
368
onExitVR : function ( ) {
362
369
var cameraRigEl = this . cameraRigEl ;
363
370
364
371
cameraRigEl . object3D . position . copy ( this . cameraRigPosition ) ;
365
372
cameraRigEl . object3D . rotation . copy ( this . cameraRigRotation ) ;
373
+
374
+ cameraRigEl . object3D . rotation . set ( 0 , 0 , 0 ) ;
366
375
} ,
367
376
368
377
onTouchMove : function ( evt ) {
0 commit comments