AugmentedFaceNode

open class AugmentedFaceNode(engine: Engine, val augmentedFace: AugmentedFace, meshMaterialInstance: MaterialInstance? = null, builder: RenderableManager.Builder.() -> Unit = {}, onTrackingStateChanged: (TrackingState) -> Unit? = null, onUpdated: (AugmentedFace) -> Unit? = null) : TrackableNode<AugmentedFace>

AR Augmented Face positioned 3D model node

Describes a face detected by ARCore and provides methods to access additional center and face region poses as well as face mesh related data.

Augmented Faces supports front-facing (selfie) camera only, and does not support attaching anchors nor raycast hit testing. Trackable.createAnchor will result in an IllegalStateException.

To use Augmented Faces, enable the feature in the session. This can be done at session creation time, or at any time during session runtime:

Session session = new Session(context, EnumSet.of(Session.Feature.FRONT_CAMERA));
Config config = ...
config.setAugmentedFaceMode(AugmentedFaceMode.MESH3D);
session.configure(config);
}

When Augmented Face mode is enabled, ARCore updates the list of detected faces for each frame. Use Session.getAllTrackables and Trackable.getTrackingState to get a list of faces that have valid meshes that can be rendered.

for (AugmentedFace face : session.getAllTrackables(AugmentedFace.class)) {
if (face.getTrackingState() == TrackingState.TRACKING) {
// Render face mesh ...
}
}
}

Faces provide static mesh data that does not change during the session, as well as pose and mesh data that is updated each frame:

// UVs and indices can be cached as they do not change during the session.
FloatBuffer uvs = face.getMeshTextureCoordinates();
ShortBuffer indices = face.getMeshTriangleIndices();

// Center and region poses, mesh vertices, and normals are updated each frame.
Pose facePose = face.getCenterPose();
FloatBuffer faceVertices = face.getMeshVertices();
FloatBuffer faceNormals = face.getMeshNormals();
}

Constructors

Link copied to clipboard
constructor(engine: Engine, augmentedFace: AugmentedFace, meshMaterialInstance: MaterialInstance? = null, builder: RenderableManager.Builder.() -> Unit = {}, onTrackingStateChanged: (TrackingState) -> Unit? = null, onUpdated: (AugmentedFace) -> Unit? = null)

Properties

Link copied to clipboard
val anchors: Collection<Anchor>

Gets the Anchors attached to this node trackable.

Link copied to clipboard
val augmentedFace: AugmentedFace
Link copied to clipboard
open var cameraTrackingState: TrackingState

Is the AR camera tracking.

Link copied to clipboard

The center of the face, defined to have the origin located behind the nose and between the two cheek bones.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val engine: Engine
Link copied to clipboard
Link copied to clipboard
var frame: Frame?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override var isRotationEditable: Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override var isVisible: Boolean
Link copied to clipboard
var Node.localPosition: Float3
Link copied to clipboard
var Node.localRotation: Float3
Link copied to clipboard
var Node.localScale: Float3
Link copied to clipboard
Link copied to clipboard
var moveHitTest: PoseNode.(Frame, MotionEvent) -> HitResult?
Link copied to clipboard
open var name: String?
Link copied to clipboard
var onAddedToScene: (scene: Scene) -> Unit?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var onDown: (e: MotionEvent) -> Boolean?
Link copied to clipboard
var onEditingChanged: (editingTransforms: Set<KProperty1<Node, Any>?>) -> Unit?
Link copied to clipboard
var onFling: (e1: MotionEvent?, e2: MotionEvent, velocity: Float2) -> Boolean?
Link copied to clipboard
var onFrame: (frameTimeNanos: Long) -> Unit?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var onPoseChanged: (Pose) -> Unit?
Link copied to clipboard
var onRemovedFromScene: (scene: Scene) -> Unit?
Link copied to clipboard
var onRotate: (detector: RotateGestureDetector, e: MotionEvent, rotationDelta: Quaternion) -> Boolean?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var onScale: (detector: ScaleGestureDetector, e: MotionEvent, scaleFactor: Float) -> Boolean?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var onScroll: (e1: MotionEvent?, e2: MotionEvent, distance: Float2) -> Boolean?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var onSmoothEnd: (node: Node) -> Unit?
Link copied to clipboard
var onTouch: (e: MotionEvent, hitResult: HitResult) -> Boolean?
Link copied to clipboard
var onTrackingStateChanged: (TrackingState) -> Unit?
Link copied to clipboard
var onUpdated: (AugmentedFace) -> Unit?
Link copied to clipboard
open var parent: Node?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var pose: Pose

The position of the intersection between a ray and detected real-world geometry.

Link copied to clipboard
open var position: Position
Link copied to clipboard
open var quaternion: Quaternion
Link copied to clipboard
val regionNodes: Map<AugmentedFace.RegionType, PoseNode>

The region nodes at the tip of the nose, the detected face's left side of the forehead, the detected face's right side of the forehead.

Link copied to clipboard
open var rotation: Rotation
Link copied to clipboard
open var scale: Scale
Link copied to clipboard
var session: Session?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var trackable: AugmentedFace?

The node world positioned trackable

Link copied to clipboard
var trackingState: TrackingState

The TrackingState of this Node.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val transformManager: TransformManager
Link copied to clipboard
var visibleCameraTrackingStates: Set<TrackingState>

Set the node to be visible only on those camera tracking states

Link copied to clipboard
val visibleTrackingStates: Set<TrackingState>

Set the node to be visible only on those tracking states

Link copied to clipboard
Link copied to clipboard
open var worldQuaternion: Quaternion
Link copied to clipboard
Link copied to clipboard
open var worldScale: Scale
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun addChildNode(node: Node): Node
Link copied to clipboard
fun addChildNodes(nodes: Set<Node>): Node
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun animatePositions(vararg positions: Position): ObjectAnimator
Link copied to clipboard
fun animateQuaternions(vararg quaternions: Quaternion): ObjectAnimator
Link copied to clipboard
fun animateRotations(vararg rotations: Rotation): ObjectAnimator
Link copied to clipboard
fun animateScales(vararg scales: Scale): ObjectAnimator
Link copied to clipboard
fun animateTransforms(vararg transforms: Transform): AnimatorSet
Link copied to clipboard
Link copied to clipboard
open override fun createAnchor(): Anchor?

Creates an anchor that is attached to this trackable, using the given initial pose in the world coordinate space.

Link copied to clipboard
open override fun createAnchorNode(): AnchorNode?

Creates an AnchorNode that is attached to this trackable, using the given initial pose in the world coordinate space.

Link copied to clipboard
open fun destroy()
Link copied to clipboard
fun getLocalPosition(worldPosition: Position): Float3
Link copied to clipboard
fun getLocalQuaternion(worldQuaternion: Quaternion): Quaternion
Link copied to clipboard
fun getLocalRotation(worldRotation: Rotation): Float3
Link copied to clipboard
fun getLocalScale(worldScale: Scale): Float3
Link copied to clipboard
fun getLocalTransform(worldTransform: Transform): Mat4
fun getLocalTransform(node: Node): Mat4
Link copied to clipboard
open override fun getTransformationMatrix(): Matrix
Link copied to clipboard
fun getWorldPosition(localPosition: Position): Float3
Link copied to clipboard
fun getWorldQuaternion(quaternion: Quaternion): Quaternion
Link copied to clipboard
fun getWorldRotation(rotation: Rotation): Float3
Link copied to clipboard
fun getWorldScale(scale: Scale): Float3
Link copied to clipboard
fun getWorldTransform(localTransform: Transform): Mat4
fun getWorldTransform(node: Node): Mat4
Link copied to clipboard
fun lookAt(targetWorldPosition: Position, upDirection: Direction, smooth: Boolean, smoothSpeed: Float): Node
fun lookAt(targetNode: Node, upDirection: Direction, smooth: Boolean, smoothSpeed: Float): Node
Link copied to clipboard
fun lookTowards(lookDirection: Direction, upDirection: Direction, smooth: Boolean, smoothSpeed: Float): Node
Link copied to clipboard
open fun onAddedToScene(scene: Scene)
Link copied to clipboard
open fun onCameraTrackingChanged(trackingState: TrackingState)
Link copied to clipboard
open override fun onContextClick(e: MotionEvent): Boolean
Link copied to clipboard
open override fun onDoubleTap(e: MotionEvent): Boolean
Link copied to clipboard
open override fun onDoubleTapEvent(e: MotionEvent): Boolean
Link copied to clipboard
open override fun onDown(e: MotionEvent): Boolean
Link copied to clipboard
open override fun onFling(e1: MotionEvent?, e2: MotionEvent, velocityX: Float, velocityY: Float): Boolean
Link copied to clipboard
open fun onFrame(frameTimeNanos: Long)
Link copied to clipboard
open override fun onLongPress(e: MotionEvent)
Link copied to clipboard
open override fun onMove(detector: MoveGestureDetector, e: MotionEvent): Boolean
open fun onMove(detector: MoveGestureDetector, e: MotionEvent, pose: Pose): Boolean
open fun onMove(detector: MoveGestureDetector, e: MotionEvent, worldPosition: Position): Boolean
Link copied to clipboard
open override fun onMoveBegin(detector: MoveGestureDetector, e: MotionEvent): Boolean
Link copied to clipboard
open override fun onMoveEnd(detector: MoveGestureDetector, e: MotionEvent)
Link copied to clipboard
open fun onPoseChanged(pose: Pose)
Link copied to clipboard
open fun onRemovedFromScene(scene: Scene)
Link copied to clipboard
open override fun onRotate(detector: RotateGestureDetector, e: MotionEvent): Boolean
open fun onRotate(detector: RotateGestureDetector, e: MotionEvent, rotationDelta: Quaternion): Boolean
Link copied to clipboard
open override fun onRotateBegin(detector: RotateGestureDetector, e: MotionEvent): Boolean
Link copied to clipboard
open override fun onRotateEnd(detector: RotateGestureDetector, e: MotionEvent)
Link copied to clipboard
open override fun onScale(detector: ScaleGestureDetector, e: MotionEvent): Boolean
open fun onScale(detector: ScaleGestureDetector, e: MotionEvent, scaleFactor: Float): Boolean
Link copied to clipboard
open override fun onScaleBegin(detector: ScaleGestureDetector, e: MotionEvent): Boolean
Link copied to clipboard
open override fun onScaleEnd(detector: ScaleGestureDetector, e: MotionEvent)
Link copied to clipboard
open override fun onScroll(e1: MotionEvent?, e2: MotionEvent, distanceX: Float, distanceY: Float): Boolean
Link copied to clipboard
open override fun onShowPress(e: MotionEvent)
Link copied to clipboard
Link copied to clipboard
open override fun onSingleTapUp(e: MotionEvent): Boolean
Link copied to clipboard
open fun onTouchEvent(e: MotionEvent, hitResult: HitResult): Boolean
Link copied to clipboard
Link copied to clipboard
fun Node.onUpdated(node: Node, frameTime: Long): Nothing?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun setScale(scale: Float)
Link copied to clipboard
open fun transform(transform: Transform, smooth: Boolean, smoothSpeed: Float): Node
fun transform(position: Position, rotation: Rotation, scale: Scale, smooth: Boolean, smoothSpeed: Float): Node
fun transform(position: Position, quaternion: Quaternion, scale: Scale, smooth: Boolean, smoothSpeed: Float): Node
Link copied to clipboard
open override fun update(trackable: AugmentedFace?)
open override fun update(session: Session, frame: Frame)
Link copied to clipboard
open fun worldTransform(worldTransform: Transform, smooth: Boolean, smoothSpeed: Float): Node
fun worldTransform(position: Position, rotation: Rotation, scale: Scale, smooth: Boolean, smoothSpeed: Float): Node
fun worldTransform(position: Position, quaternion: Quaternion, scale: Scale, smooth: Boolean, smoothSpeed: Float): Node