public final class ARHitResult
- Object
- ARHitResult
One intersection returned by
ARSession#hitTest(float, float): the world
pose where the ray from the screen point met real-world geometry. Call
#createAnchor() to place content at the hit.Nested types
enum ARHitResult.Type | The kind of real-world geometry the hit ray intersected. |
Constructors
public ARHitResult(ARPose pose, float distance, ARHitResult.Type type, ARPlane plane, Object nativeHandle) | Creates a hit result. |
Methods
public ARPose getPose() | The world pose of the intersection. |
public float getDistance() | The distance from the camera to the hit in meters. |
public ARHitResult.Type getType() | The kind of geometry the ray intersected. |
public ARPlane getPlane() | The plane that was hit, or null for non-plane hits. |
public Object getNativeHandle() | The opaque platform token backing this hit. |
public ARAnchor createAnchor() | Creates an anchor at this hit, letting the platform anchor to the exact native raycast result when available. |
Inherited methods
Constructor details
ARHitResult
public ARHitResult(ARPose pose, float distance, ARHitResult.Type type, ARPlane plane, Object nativeHandle)Creates a hit result. Intended for platform implementations and tests;
applications receive hit results from
ARSession#hitTest(float, float).Parameters
poseARPose- the world pose of the intersection, local Y along the surface normal
distancefloat- the distance from the camera in meters
typeARHitResult.Type- the kind of geometry hit
planeARPlane- the plane that was hit, or null for non-plane hits
nativeHandleObject- an opaque platform token that lets
#createAnchor()anchor to the exact native hit, or null
Method details
getPose
public ARPose getPose()The world pose of the intersection. Local Y points along the surface
normal.
getDistance
public float getDistance()The distance from the camera to the hit in meters.
getType
public ARHitResult.Type getType()The kind of geometry the ray intersected.
getPlane
public ARPlane getPlane()The plane that was hit, or null for non-plane hits.
getNativeHandle
public Object getNativeHandle()The opaque platform token backing this hit. Intended for platform
implementations.
createAnchor
public ARAnchor createAnchor()Creates an anchor at this hit, letting the platform anchor to the
exact native raycast result when available.
Returns
the new anchor, registered with the session