HitTestResult

  • HitTestResult stores the results of Scene hit tests, providing information about the hit.

  • It contains data about the hit node, distance to the hit, and the hit location in world-space.

  • You can access this information via getNode() , getDistance() , and getPoint() methods respectively.

  • Primarily used with Scene.hitTest and Scene.hitTestAll for detecting collisions in AR scenes.

public class HitTestResult

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 Constructors

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

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.

Returns
  • the hit node

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
Design a Mobile Site
View Site in Mobile | Classic
Share by: