- Sceneform SDK for Android
was open sourced and archived ( github.com/google-ar/sceneform-android-sdk
) with version 1.16.0.
- This site ( developers.google.com/sceneform
) serves as the documentation archive for the previous version, Sceneform SDK for Android
1.15.0.
- Do not use version 1.17.0 of the Sceneform Maven artifacts
.
- The 1.17.1 Maven artifacts can be used. Other than the version, however, the 1.17.1 artifacts are identical to the 1.15.0 artifacts.
Scene.OnTouchListener
Stay organized with collections
Save and categorize content based on your preferences.
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
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
Returns
- true if the listener has consumed the event
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-06-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-06-26 UTC."],[[["\u003cp\u003e\u003ccode\u003eScene.OnTouchListener\u003c/code\u003e is an interface used to handle touch events dispatched to a Scene in ARCore's Sceneform.\u003c/p\u003e\n"],["\u003cp\u003eIt provides a callback, \u003ccode\u003eonSceneTouch\u003c/code\u003e, that is triggered when a touch occurs in the scene, but only if no node in the scene has already handled the touch event.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eonSceneTouch\u003c/code\u003e callback receives a \u003ccode\u003eHitTestResult\u003c/code\u003e indicating what was touched (or null if nothing) and a \u003ccode\u003eMotionEvent\u003c/code\u003e containing details of the touch action.\u003c/p\u003e\n"],["\u003cp\u003eReturning \u003ccode\u003etrue\u003c/code\u003e from \u003ccode\u003eonSceneTouch\u003c/code\u003e indicates that the listener has consumed the event, preventing further processing.\u003c/p\u003e\n"]]],["The `Scene.OnTouchListener` interface provides a callback for touch events dispatched to a scene. The `onSceneTouch` method is invoked when a touch event occurs, after it's been dispatched to scene nodes. This method receives a `HitTestResult`, indicating the touched node (or null if no node was touched), and the `MotionEvent`. The listener can consume the event by returning true. This allows responding to touch events that weren't handled by any node in the scene.\n"],null,["# Scene.OnTouchListener\n\npublic static interface **Scene.OnTouchListener** \nInterface definition for a callback to be invoked when a touch event is dispatched to a scene.\nThe callback will be invoked after the touch event is dispatched to the nodes in the scene if\nno node consumed the event. \n\n### Public Methods\n\n|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract boolean | [onSceneTouch](/sceneform/reference/com/google/ar/sceneform/Scene.OnTouchListener#onSceneTouch(com.google.ar.sceneform.HitTestResult,%20android.view.MotionEvent))([HitTestResult](/sceneform/reference/com/google/ar/sceneform/HitTestResult) hitTestResult, [MotionEvent](https://developer.android.com/reference/android/view/MotionEvent) motionEvent) Called when a touch event is dispatched to a scene. |\n\nPublic Methods\n--------------\n\n#### public abstract boolean\n**onSceneTouch**\n([HitTestResult](/sceneform/reference/com/google/ar/sceneform/HitTestResult) hitTestResult, [MotionEvent](https://developer.android.com/reference/android/view/MotionEvent) motionEvent)\n\nCalled when a touch event is dispatched to a scene. The callback will be invoked after the\ntouch event is dispatched to the nodes in the scene if no node consumed the event. This is\ncalled even if the touch is not over a node, in which case [getNode()](/sceneform/reference/com/google/ar/sceneform/HitTestResult#getNode())\nwill be null. \n\n##### Parameters\n\n| hitTestResult | represents the node that was touched |\n| motionEvent | the motion event |\n|---------------|--------------------------------------|\n\n##### Returns\n\n- true if the listener has consumed the event \n\n##### See Also\n\n- [setOnTouchListener(OnTouchListener)](/sceneform/reference/com/google/ar/sceneform/Scene#setOnTouchListener(com.google.ar.sceneform.Scene.OnTouchListener))"]]