AI-generated Key Takeaways
-
Scene.OnTouchListeneris an interface used to handle touch events dispatched to a Scene in ARCore's Sceneform. -
It provides a callback,
onSceneTouch, that is triggered when a touch occurs in the scene, but only if no node in the scene has already handled the touch event. -
The
onSceneTouchcallback receives aHitTestResultindicating what was touched (or null if nothing) and aMotionEventcontaining details of the touch action. -
Returning
truefromonSceneTouchindicates that the listener has consumed the event, preventing further processing.
Interface definition for a callback to be invoked when a touch event is dispatched to a scene. The callback will be invoked after the touch event is dispatched to the nodes in the scene if no node consumed the event.
Public Methods
| abstract boolean |
onSceneTouch(HitTestResult hitTestResult, MotionEvent motionEvent)
Called when a touch event is dispatched to a scene.
|
Public Methods
public abstract boolean onSceneTouch (HitTestResult hitTestResult, MotionEvent motionEvent)
Called when a touch event is dispatched to a scene. The callback will be invoked after the
touch event is dispatched to the nodes in the scene if no node consumed the event. This is
called even if the touch is not over a node, in which case getNode()
will be null.
Parameters
| hitTestResult | represents the node that was touched |
|---|---|
| motionEvent | the motion event |
Returns
- true if the listener has consumed the event