# Class ARHitResult

java.lang.Object
com.codename1.ar.ARHitResult

public final class ARHitResult extends Object
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 Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `ARHitResult.Type`
  The kind of real-world geometry the hit ray intersected.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ARHitResult(ARPose pose, float distance, ARHitResult.Type type, ARPlane plane, Object nativeHandle)`
  Creates a hit result.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ARAnchor`
  `createAnchor()`
  Creates an anchor at this hit, letting the platform anchor to the exact native raycast result when available.
  `float`
  `getDistance()`
  The distance from the camera to the hit in meters.
  `Object`
  `getNativeHandle()`
  The opaque platform token backing this hit.
  `ARPlane`
  `getPlane()`
  The plane that was hit, or null for non-plane hits.
  `ARPose`
  `getPose()`
  The world pose of the intersection.
  `ARHitResult.Type`
  `getType()`
  The kind of geometry the ray intersected.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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

    - `pose`: the world pose of the intersection, local Y along the surface normal

    - `distance`: the distance from the camera in meters

    - `type`: the kind of geometry hit

    - `plane`: the plane that was hit, or null for non-plane hits

    - `nativeHandle`: 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