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.
-
ClassDescriptionEntry point for the cross-platform augmented reality API.A fixed position and orientation in the real world that the AR session keeps tracking as its understanding of the environment improves.Describes a change to an
ARAnchor, delivered toARAnchorListeners on the EDT.The kind of change that occurred.Observes anchor changes, including platform-recognized images and faces.Describes which AR features the current device supports.An anchor tracking a face in aARTrackingMode#FACEsession.Named face regions whose poses can be queried from anARFaceAnchor.One intersection returned byARSession#hitTest(float, float): the world pose where the ray from the screen point met real-world geometry.The kind of real-world geometry the hit ray intersected.An anchor tracking a recognizedARReferenceImagein the real world.An estimate of the real-world lighting around the device, used to shade virtual content so it blends with the camera image.The renderable content of anARNode: geometry plus an optional base-color texture or solid color.A node in the small scene graph rendered at anARAnchor.A real-world surface detected by the AR session, such as a floor, table or wall.The orientation of a detected plane.Which real-world surface orientations anARSessionshould detect and report asARPlanes.Describes a change to a detectedARPlane, delivered toARPlaneListeners on the EDT.The kind of change that occurred.Observes plane detection.An immutable rigid transform - a rotation followed by a translation - that positions something in AR world space.A 2D image the AR session should recognize in the real world - a poster, a game board, a product label.Active augmented reality session.Configuration for anARSession.Why anARSessionreportsARTrackingState#LIMITEDorARTrackingState#NOT_TRACKING.Observes changes to a session's overall tracking quality.The tracking configuration of anARSession.The quality of pose tracking for anARSessionor an individual trackable such as anARAnchororARPlane.Component that renders the AR camera image composited with the session's anchored 3D content.