Class ARFaceAnchor

java.lang.Object
com.codename1.ar.ARAnchor
com.codename1.ar.ARFaceAnchor

public class ARFaceAnchor extends ARAnchor

An anchor tracking a face in a ARTrackingMode#FACE session. The anchor pose is centered on the head; named regions and an optional face mesh give finer geometry for effects such as filters or virtual try-on.

Platform capabilities differ: region poses and the mesh may be null on platforms that do not supply them - always handle the null case. Delivered through the session's ARAnchorListener; use instanceof to distinguish face anchors from plain anchors.

  • Constructor Details

    • ARFaceAnchor

      public ARFaceAnchor(String id, ARPose pose)

      Creates a face anchor. Intended for platform implementations and tests.

      Parameters
      • id: the stable identifier of this anchor

      • pose: the initial world pose, centered on the head

  • Method Details

    • getRegionPose

      public ARPose getRegionPose(ARFaceRegion region)

      The pose of a named face region in world space, or null when the platform does not supply that region.

      Parameters
      • region: the face region to query
      Returns

      the region pose or null

    • getMeshVertices

      public float[] getMeshVertices()
      The face mesh vertices as x, y, z triples in the anchor's local frame, or null when the platform supplies no mesh. The array is the live buffer updated each frame; copy it if you need a stable snapshot.
    • getMeshTriangles

      public int[] getMeshTriangles()
      The face mesh triangle indices (three per triangle into #getMeshVertices()), or null when the platform supplies no mesh.