Created
February 12, 2022 08:39
-
-
Save sarimmehdi/7eae175bf295efde205e3a04c23a31af to your computer and use it in GitHub Desktop.
listen for touch events on ArSceneView
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arSceneView.scene.setOnTouchListener { | |
hitTestResult : HitTestResult?, motionEvent : MotionEvent? -> | |
gestureDetectorCompat!!.onTouchEvent(motionEvent) | |
when (gestureDetector.gestureType) { | |
GestureDetector.GestureType.SINGLE_TAP -> { | |
Toast.makeText(this, "SINGLE TAP", Toast.LENGTH_SHORT).show() | |
} | |
GestureDetector.GestureType.DOUBLE_TAP -> { | |
Toast.makeText(this, "DOUBLE TAP", Toast.LENGTH_SHORT).show() | |
} | |
GestureDetector.GestureType.LONG_PRESS -> { | |
Toast.makeText(this, "LONG PRESS", Toast.LENGTH_SHORT).show() | |
} | |
else -> { } | |
} | |
gestureDetector.resetGestureType() | |
true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment