package com.codename1.ar

Cross-platform augmented reality: world tracking, plane detection, hit testing, anchors, 3D content placement, light estimation, image tracking and face tracking, backed by ARKit on iOS and ARCore on Android.

Start at AR: check AR#isSupported() and per-feature AR#getCapabilities(), then AR#open(ARSessionOptions) a session and add its ARSession#createView() to a form. Place content by hit testing screen taps (ARSession#hitTest(float, float)), creating an ARAnchor at a hit and attaching an ARNode holding an ARModel (glTF or com.codename1.gpu.Mesh geometry).

Coordinates: world space is right-handed, in meters, with Y up and -Z forward from the initial camera direction - the convention shared by ARKit and ARCore. Poses are ARPose (translation + quaternion), convertible to com.codename1.gpu.Matrix4 compatible matrices.

Threading: all listeners fire on the EDT and all getters reflect the latest delivered state. High-frequency refinements are coalesced.

Permissions and dependencies: referencing this package makes the build pipeline inject the camera permission and plist usage description plus the platform AR dependency into the application automatically; apps that do not use AR pay no cost. Devices without AR hardware report AR#isSupported() false, as do the simulator-less desktop targets - the Codename One simulator itself ships a simulated AR environment for development.

Types

class AREntry point for the cross-platform augmented reality API.
class ARAnchorA fixed position and orientation in the real world that the AR session keeps tracking as its understanding of the environment improves.
class ARAnchorEventDescribes a change to an ARAnchor, delivered to ARAnchorListeners on the EDT.
interface ARAnchorListenerObserves anchor changes, including platform-recognized images and faces.
class ARCapabilitiesDescribes which AR features the current device supports.
class ARFaceAnchorAn anchor tracking a face in a ARTrackingMode#FACE session.
enum ARFaceRegionNamed face regions whose poses can be queried from an ARFaceAnchor.
class ARHitResultOne intersection returned by ARSession#hitTest(float, float): the world pose where the ray from the screen point met real-world geometry.
class ARImageAnchorAn anchor tracking a recognized ARReferenceImage in the real world.
class ARLightEstimateAn estimate of the real-world lighting around the device, used to shade virtual content so it blends with the camera image.
class ARModelThe renderable content of an ARNode: geometry plus an optional base-color texture or solid color.
class ARNodeA node in the small scene graph rendered at an ARAnchor.
class ARPlaneA real-world surface detected by the AR session, such as a floor, table or wall.
enum ARPlaneDetectionWhich real-world surface orientations an ARSession should detect and report as ARPlanes.
class ARPlaneEventDescribes a change to a detected ARPlane, delivered to ARPlaneListeners on the EDT.
interface ARPlaneListenerObserves plane detection.
class ARPoseAn immutable rigid transform - a rotation followed by a translation - that positions something in AR world space.
class ARReferenceImageA 2D image the AR session should recognize in the real world - a poster, a game board, a product label.
class ARSessionActive augmented reality session.
class ARSessionOptionsConfiguration for an ARSession.
enum ARTrackingFailureReasonWhy an ARSession reports ARTrackingState#LIMITED or ARTrackingState#NOT_TRACKING.
interface ARTrackingListenerObserves changes to a session’s overall tracking quality.
enum ARTrackingModeThe tracking configuration of an ARSession.
enum ARTrackingStateThe quality of pose tracking for an ARSession or an individual trackable such as an ARAnchor or ARPlane.
class ARViewComponent that renders the AR camera image composited with the session’s anchored 3D content.