Head
ClassUsed to move and rotate SceneObjects in sync with the user's head movements.
- Available on all platforms
Index
Properties
Methods
Example
// Switch to the next available face on tap when Head component is active
// @input Component.Head head
const numFaceToIterate = 2;
script.createEvent("TapEvent").bind(function() {
if (script.head.getSceneObject().isEnabledInHierarchy) {
nextFaceIndex = (script.head.faceIndex + 1) % numFaceToIterate;
script.head.faceIndex = nextFaceIndex;
}
})
// Change the attachment point type to HeadCenter
//@input Component.Head head
script.head.setAttachmentPointType(AttachmentPointType.HeadCenter);
Extends
Properties
enabled
enabled:
boolean
If disabled, the Component will stop enacting its behavior.
Default Value
true
Inherited from
faceIndex
faceIndex:
number
The index of the face this head is attached to.
Default Value
0
isBeingDestroyed
readonlyisBeingDestroyed:boolean
Returns true if this Component is currently being destroyed. Becomes true as soon as
destruction begins via Component#destroy or destruction of its owning SceneObject,
before any OnDestroyEvent callbacks fire.
Since
Lens Scripting Version 364
Example
if (!script.isBeingDestroyed) {
// Component is still fully alive
}
Inherited from
isEnabledInHierarchy
readonlyisEnabledInHierarchy:boolean
Returns true if this Component, its SceneObject, and all of that SceneObjects parents are enabled.
Inherited from
Component.isEnabledInHierarchy
onLandmarksUpdate
readonlyonLandmarksUpdate:event1<vec2[],void>
Triggered when the landmarks on the head are updated.
Since
Lens Scripting Version 305
sceneObject
readonlysceneObject:SceneObject
The SceneObject this component is on.
Inherited from
trackingScope
trackingScope:
FaceTrackingScope|TextureTrackingScope|PersonTrackingScope
The tracking context this effect is being applied to.
Since
Lens Scripting Version 309
Default Value
null
trackingStatus
readonlytrackingStatus:TrackingStatus
Access to the TrackingStatus for this Component. Can be used to check if tracking is available and subscribe to events for status changes.
uniqueIdentifier
readonlyuniqueIdentifier:string
Since
Lens Scripting Version 176
Inherited from
Methods
destroy()
destroy():
void
Destroys the component.
Returns
void
Inherited from
getSceneObject()
getSceneObject():
SceneObject
Returns the SceneObject the component is attached to.
Returns
Inherited from
getTransform()
getTransform():
Transform
Returns the Transform this component is attached to.
Returns
Inherited from
getTypeName()
staticgetTypeName():TypeName<Head>
Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().
Returns
TypeName<Head>
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean
Inherited from
setAttachmentPointType()
setAttachmentPointType(
attachmentPointType):void
Changes the attachment point type used to anchor this object to a face.
Parameters
| Parameter | Type |
|---|---|
attachmentPointType | AttachmentPointType |
Returns
void
See also
Head Attached 3D Objects guide.