@@ -44,6 +44,7 @@ public class ControllerInteraction : MonoBehaviour
44
44
private bool loadedHandModel = false ;
45
45
private string loadedHandProfile = null ;
46
46
private Dictionary < int , Transform > handModelJoints = new Dictionary < int , Transform > ( ) ;
47
+ private static Quaternion quat180 = Quaternion . Euler ( 0 , 180 , 0 ) ;
47
48
#endif
48
49
49
50
private void Awake ( )
@@ -291,7 +292,7 @@ private void OnHandUpdate(WebXRHandData handData)
291
292
if ( handModelJoints . ContainsKey ( i ) )
292
293
{
293
294
handModelJoints [ i ] . localPosition = rotationOffset * ( handData . joints [ i ] . position - handData . joints [ 0 ] . position ) ;
294
- handModelJoints [ i ] . localRotation = rotationOffset * handData . joints [ i ] . rotation ;
295
+ handModelJoints [ i ] . localRotation = rotationOffset * handData . joints [ i ] . rotation * quat180 ;
295
296
}
296
297
}
297
298
return ;
@@ -441,15 +442,15 @@ private void HandleHandModelLoaded(bool success)
441
442
var inputProfileModelTransform = inputProfileHandModel . transform ;
442
443
inputProfileModelTransform . SetParent ( inputProfileHandModelParent . transform ) ;
443
444
inputProfileModelTransform . localPosition = Vector3 . zero ;
444
- inputProfileModelTransform . localRotation = Quaternion . identity ;
445
+ inputProfileModelTransform . localRotation = quat180 ;
445
446
inputProfileModelTransform . localScale = Vector3 . one ;
446
447
for ( int i = 0 ; i <= ( int ) WebXRHandJoint . pinky_finger_tip ; i ++ )
447
448
{
448
449
handModelJoints . Add ( i , inputProfileHandModel . GetChildTransform ( ( ( WebXRHandJoint ) i ) . ToString ( ) . Replace ( '_' , '-' ) ) ) ;
449
450
// It took at least one frame with hand data, there should be hand joint transform
450
451
if ( handJoints . ContainsKey ( i ) )
451
452
{
452
- handModelJoints [ i ] . SetPositionAndRotation ( handJoints [ i ] . position , handJoints [ i ] . rotation ) ;
453
+ handModelJoints [ i ] . SetPositionAndRotation ( handJoints [ i ] . position , handJoints [ i ] . rotation * quat180 ) ;
453
454
if ( useCollidersForHandJoints )
454
455
{
455
456
var collider = handModelJoints [ i ] . gameObject . AddComponent < SphereCollider > ( ) ;
0 commit comments