public class ARFaceAnchor
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.
Constructors
public ARFaceAnchor(String id, ARPose pose) | Creates a face anchor. |
Methods
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. |
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. |
public int[] getMeshTriangles() | The face mesh triangle indices (three per triangle into #getMeshVertices()), or null when the platform supplies no mesh. |
Inherited methods
From ARAnchor
getId, getPose, getTrackingState, getNode, setNode, detach, isDetached
Constructor details
ARFaceAnchor
public ARFaceAnchor(String id, ARPose pose)Creates a face anchor. Intended for platform implementations and
tests.
Parameters
idString- the stable identifier of this anchor
poseARPose- 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
regionARFaceRegion- 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.