@@ -53,7 +53,10 @@ export var Component = registerComponent('hand-controls', {
5353 schema : {
5454 color : { default : 'white' , type : 'color' } ,
5555 hand : { default : 'left' } ,
56- handModelStyle : { default : 'lowPoly' , oneOf : [ 'lowPoly' , 'highPoly' , 'toon' ] }
56+ handModelStyle : { default : 'lowPoly' , oneOf : [ 'lowPoly' , 'highPoly' , 'toon' ] } ,
57+ // Default rotation and position is aligned with Meta Quest Controllers in the Meta Horizon Browser
58+ offSetRotation : { default : { x : '45' , y : '0' , z : '90' } , type : 'vec3' } ,
59+ offSetPosition : { default : { x : '0' , y : '0' , z : '0.02' } , type : 'vec3' }
5760 } ,
5861
5962 after : [ 'tracked-controls' ] ,
@@ -117,24 +120,19 @@ export var Component = registerComponent('hand-controls', {
117120 var el = this . el ;
118121 var hand = this . data . hand ;
119122 var mesh = this . el . getObject3D ( 'mesh' ) ;
123+ var offSetRotation = this . data . offSetRotation ;
124+ var offSetPosition = this . data . offSetPosition ;
120125
121126 el . object3D . visible = true ;
122127
123- var handModelOrientationZ = hand === 'left' ? Math . PI / 2 : - Math . PI / 2 ;
124128 // The WebXR standard defines the grip space such that a cylinder held in a closed hand points
125129 // along the Z axis. The models currently have such a cylinder point along the X-Axis.
126- var handModelOrientationX = el . sceneEl . hasWebXR ? - Math . PI / 2 : 0 ;
127-
128- // Pico4, at least on Wolvic, needs a different rotation offset
129- // for the hand model. Pico Browser claims to use oculus
130- // controllers instead; will load meta-touch-controls and does
131- // not require this adjustment.
132- if ( evt . detail . name === 'pico-controls' ) {
133- handModelOrientationX += Math . PI / 4 ;
134- }
130+ var handModelOrientationX = el . sceneEl . hasWebXR ? - THREE . MathUtils . degToRad ( offSetRotation . x ) : 0 ;
131+ var handModelOrientationY = THREE . MathUtils . degToRad ( offSetRotation . y ) ;
132+ var handModelOrientationZ = hand === 'left' ? THREE . MathUtils . degToRad ( offSetRotation . z ) : - THREE . MathUtils . degToRad ( offSetRotation . z ) ;
135133
136- mesh . position . set ( 0 , 0 , 0 ) ;
137- mesh . rotation . set ( handModelOrientationX , 0 , handModelOrientationZ ) ;
134+ mesh . position . set ( offSetPosition . x , offSetPosition . y , offSetPosition . z ) ;
135+ mesh . rotation . set ( handModelOrientationX , handModelOrientationY , handModelOrientationZ ) ;
138136 } ,
139137
140138 onControllerDisconnected : function ( ) {
0 commit comments