If disabled, the Component will stop enacting its behavior.
The index of the face this head is attached to.
ReadonlyisReturns true if this Component, its SceneObject, and all of that SceneObjects parents are enabled.
ReadonlyonTriggered when the landmarks on the head are updated.
ReadonlysceneThe SceneObject this component is on.
The tracking context this effect is being applied to.
ReadonlyuniqueDestroys the component.
For finding out whether any faces are tracked you should use SceneObject.isEnabledInHierarchy on the object containing the Head component instead. You can check for a given count by assigning face index on the Head Component.
/ **
* Gets the count of enabled Head components (faces) in the scene hierarchy
* @param {SceneObject} parentObject - The parent object of head binding components to search from
* @returns {number} The number of enabled Head components found
* /
function getFacesCount(parentObject) {
return getComponentsRecursive(parentObject, "Component.Head")
.filter(head => head.isEnabledInHierarchy)
.length;
}
/ **
* Recursively searches through scene object hierarchy to find all components of a specific type
* @param {SceneObject} object - The scene object to search
* @param {string} componentType - The type of component to find (e.g., "Component.Head")
* @param {Component[]} results - Optional array to accumulate results
* @returns {Component[]} Array of all matching components found in the hierarchy
* /
function getComponentsRecursive(object, componentType, results) {
results = results || [];
// Get all components of the specified type from current object
var components = object.getComponents(componentType);
for (var i=0; i<components.length; i++) {
results.push(components[i]);
}
// Recursively search all child objects
var childCount = object.getChildrenCount();
for (var j=0; j<childCount; j++) {
getComponentsRecursive(object.getChild(j), componentType, results);
}
return results;
}
Returns the total number of faces currently being tracked.
Returns the screen position of the face landmark at the passed in index.
Returns the SceneObject the component is attached to.
Returns the Transform this component is attached to.
Returns the name of this object's type.
Returns true if the object matches or derives from the passed in type.
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Changes the attachment point type used to anchor this object to a face.
Used to move and rotate SceneObjects in sync with the user's head movements.
See
Head Attached 3D Objects guide.
Example