Most visited

Recently visited

ARHitTestResult

public class ARHitTestResult
extends Object

java.lang.Object
   ↳ com.viro.core.ARHitTestResult


ARHitTestResult encapsulates a single result of an AR hit-test. AR hit-tests are initiated from the ViroViewARCore. These hit tests are a mechanism for you to discover what real-world objects are contained along a given ray in the Scene or at a given 2D point on the ViroViewARCore.

Summary

Nested classes

enum ARHitTestResult.Type

Hit-tests can intersect different kinds of real-world features, each identified by their Type. 

Public methods

ARNode createAnchoredNode()

Create an ARNode that will be anchored to the real-world position associated with this hit result.

void dispose()

Release native resources associated with this ARHitTestResult.

Vector getPosition()

Returns the position of the detected real-world object, in world coordinates.

Vector getRotation()

Return the orientation of the detected real-world object, along each of the three principal axes.

Vector getScale()

Return the scale of the detected real-world object.

ARHitTestResult.Type getType()

Returns the kind of detected real-world object contained in this result.

Public methods

createAnchoredNode

ARNode createAnchoredNode ()

Create an ARNode that will be anchored to the real-world position associated with this hit result. Anchoring a node to a hit-result will help ensure that the objects you attach to this node will track properly and remain in place.

The returned ARNode is automatically added to the Scene, and will be continually updated to stay in the sync with its underlying anchor as the anchor's properties, orientation, or position change.

If there is already an ARNode associated with this hit result, that ARNode will be returned here. If AR tracking is limited, this method will return null.

When finished with this ARNode, you must call detach() to remove it from the system. If you do not detach the ARNode, it will continue to receive tracking updates from the AR subsystem, adversely impacting performance.

Returns
ARNode New ARNode anchored to the hit result position, or null if AR tracking is currently limited.

dispose

void dispose ()

Release native resources associated with this ARHitTestResult.

getPosition

Vector getPosition ()

Returns the position of the detected real-world object, in world coordinates.

Returns
Vector The position in world coordinates, in a Vector.

getRotation

Vector getRotation ()

Return the orientation of the detected real-world object, along each of the three principal axes.

Returns
Vector The rotation in radians along the X, Y, and Z axes, stored in a Vector.

getScale

Vector getScale ()

Return the scale of the detected real-world object.

Returns
Vector The scale in a Vector.

getType

ARHitTestResult.Type getType ()

Returns the kind of detected real-world object contained in this result.

Returns
ARHitTestResult.Type The type of the real-world object.

Hooray!