- 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.
HitTestResult
Stay organized with collections
Save and categorize content based on your preferences.
Stores the results of calls to Scene.hitTest and Scene.hitTestAll. Contains a node that was hit
by the hit test, and associated information.
Public Methods
float |
getDistance
() Get the distance along the ray to the impact point on the surface of the collision shape.
|
Node
|
getNode
() The node that was hit by the hit test.
|
Vector3
|
getPoint
() Get the position in world-space where the ray hit the collision shape.
|
Inherited Methods
From class
java.lang.Object
Public Constructors
public
HitTestResult
()
Public Methods
public
float
getDistance
()
Get the distance along the ray to the impact point on the surface of the collision shape.
Returns
- distance along the ray that the hit occurred at
public Node
getNode
()
The node that was hit by the hit test. Null when there is no hit.
public Vector3
getPoint
()
Get the position in world-space where the ray hit the collision shape.
Returns
- a new vector that represents the position in world-space that the hit occurred at
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\u003eHitTestResult\u003c/code\u003e stores the results of Scene hit tests, providing information about the hit.\u003c/p\u003e\n"],["\u003cp\u003eIt contains data about the hit node, distance to the hit, and the hit location in world-space.\u003c/p\u003e\n"],["\u003cp\u003eYou can access this information via \u003ccode\u003egetNode()\u003c/code\u003e, \u003ccode\u003egetDistance()\u003c/code\u003e, and \u003ccode\u003egetPoint()\u003c/code\u003e methods respectively.\u003c/p\u003e\n"],["\u003cp\u003ePrimarily used with \u003ccode\u003eScene.hitTest\u003c/code\u003e and \u003ccode\u003eScene.hitTestAll\u003c/code\u003e for detecting collisions in AR scenes.\u003c/p\u003e\n"]]],["`HitTestResult` stores data from `Scene.hitTest` calls, including the impacted node. Key actions include retrieving the hit node via `getNode()`, the distance to the impact point with `getDistance()`, and the world-space position of the hit using `getPoint()`. A new `HitTestResult` object is constructed using `HitTestResult()`. Inherited methods like `clone()` and `equals()` are also available from `java.lang.Object`.\n"],null,["# HitTestResult\n\npublic class **HitTestResult** \nStores the results of calls to Scene.hitTest and Scene.hitTestAll. Contains a node that was hit\nby the hit test, and associated information. \n\n### Public Constructors\n\n|---|-----------------------------------------------------------------------------------------------|\n| | [HitTestResult](/sceneform/reference/com/google/ar/sceneform/HitTestResult#HitTestResult())() |\n\n### Public Methods\n\n|----------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| float | [getDistance](/sceneform/reference/com/google/ar/sceneform/HitTestResult#getDistance())() Get the distance along the ray to the impact point on the surface of the collision shape. |\n| [Node](/sceneform/reference/com/google/ar/sceneform/Node) | [getNode](/sceneform/reference/com/google/ar/sceneform/HitTestResult#getNode())() The node that was hit by the hit test. |\n| [Vector3](/sceneform/reference/com/google/ar/sceneform/math/Vector3) | [getPoint](/sceneform/reference/com/google/ar/sceneform/HitTestResult#getPoint())() Get the position in world-space where the ray hit the collision shape. |\n\n### Inherited Methods\n\nFrom class java.lang.Object \n\n|-----------------------------------------------------------------------------|---------------------------------------------------------------------------------|\n| [Object](https://developer.android.com/reference/java/lang/Object) | clone() |\n| boolean | equals([Object](https://developer.android.com/reference/java/lang/Object) arg0) |\n| void | finalize() |\n| final [Class](https://developer.android.com/reference/java/lang/Class)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](https://developer.android.com/reference/java/lang/String) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Constructors\n-------------------\n\n#### public\n**HitTestResult**\n()\n\n\u003cbr /\u003e\n\nPublic Methods\n--------------\n\n#### public float\n**getDistance**\n()\n\nGet the distance along the ray to the impact point on the surface of the collision shape. \n\n##### Returns\n\n- distance along the ray that the hit occurred at \n\n#### public [Node](/sceneform/reference/com/google/ar/sceneform/Node)\n**getNode**\n()\n\nThe node that was hit by the hit test. Null when there is no hit. \n\n##### Returns\n\n- the hit node \n\n#### public [Vector3](/sceneform/reference/com/google/ar/sceneform/math/Vector3)\n**getPoint**\n()\n\nGet the position in world-space where the ray hit the collision shape. \n\n##### Returns\n\n- a new vector that represents the position in world-space that the hit occurred at"]]