Head
Lens Studio v1.5.0+
Scripting Name: Component.Head
Inherits from Component
Description
Binds the SceneObject to a tracked face. See the Head Attached 3D Objects Guide for more information.
Methods
getFacesCount()
: Number
Returns the total number of faces currently being tracked.
getLandmark(Number index)
: vec2
Returns the screen position of the face landmark at the passed in index.
getLandmarkCount()
: Number
Returns the number of face landmarks being tracked.
getLandmarks()
: vec2
[]
Returns a list of screen positions of all tracked landmarks.
setAttachmentPointType(AttachmentPointType attachmentPointType)
: void
Changes the attachment point type used to anchor this object to a face.
Properties
faceIndex
: Number
The index of the face this head is attached to.
Inherited Methods
destroy()
: void
Destroys the component.
getSceneObject()
: SceneObject
Returns the SceneObject the component is attached to.
getTransform()
: Transform
Returns the Transform this component is attached to.
isSame(SerializableWithUID other)
: Boolean
Returns true if this object is the same as other
. Useful for checking if two references point to the same thing.
getTypeName()
: String
Returns the name of this object’s type.
isOfType(String type)
: Boolean
Returns true if the object matches or derives from the passed in type.
Inherited Properties
enabled
: Boolean
If disabled, the Component will stop enacting its behavior.
Examples
// Switch to the next available face
//@input Component.Head head
var nextFaceIndex = script.head.faceIndex + 1;
if(nextFaceIndex >= script.head.getFacesCount())
nextFaceIndex = 0;
script.head.faceIndex = nextFaceIndex;
// Change the attachment point type to HeadCenter
//@input Component.Head head
script.head.setAttachmentPointType(AttachmentPointType.HeadCenter);
Still Looking for help?
Visit Support