1616
1717package com.example.xr.arcore
1818
19+ import android.app.Activity
1920import androidx.activity.ComponentActivity
2021import androidx.lifecycle.lifecycleScope
2122import androidx.xr.arcore.Hand
@@ -30,6 +31,7 @@ import androidx.xr.runtime.math.Pose
3031import androidx.xr.runtime.math.Quaternion
3132import androidx.xr.runtime.math.Vector3
3233import androidx.xr.scenecore.scene
34+ import kotlinx.coroutines.flow.Flow
3335import kotlinx.coroutines.launch
3436
3537fun ComponentActivity.configureSession (session : Session ) {
@@ -64,6 +66,16 @@ fun ComponentActivity.collectHands(session: Session) {
6466 }
6567}
6668
69+ fun secondaryHandDetection (activity : Activity , session : Session ) {
70+ fun detectGesture (handState : Flow <Hand .State >) {}
71+ // [START androidxr_arcore_hand_handedness]
72+ val handedness = Hand .getHandedness(activity.contentResolver)
73+ val secondaryHand = if (handedness == Hand .Handedness .LEFT ) Hand .right(session) else Hand .left(session)
74+ val handState = secondaryHand?.state ? : return
75+ detectGesture(handState)
76+ // [END androidxr_arcore_hand_handedness]
77+ }
78+
6779fun ComponentActivity.renderPlanetAtHandPalm (leftHandState : Hand .State ) {
6880 val session: Session = null !!
6981 val palmEntity: GltfEntity = null !!
0 commit comments