ScriptAvatar

Description

Supported Script Types: Interface Scripts • Client Entity Scripts • Avatar Scripts • Server Entity Scripts • Assignment Client Scripts

Information about an avatar.

Create using MyAvatar.getTargetAvatar or AvatarList.getAvatar.

Properties

Name Type Summary
position Vec3

The avatar's position.

scale number

The target scale of the avatar without any restrictions on permissible values imposed by the domain.

handPosition Vec3

A user-defined hand position, in world coordinates. The position moves with the avatar but is otherwise not used or changed by Interface.

bodyPitch number

The pitch of the avatar's body, in degrees.

bodyYaw number

The yaw of the avatar's body, in degrees.

bodyRoll number

The roll of the avatar's body, in degrees.

orientation Quat

The orientation of the avatar's body.

headOrientation Quat

The orientation of the avatar's head.

headPitch number

The pitch of the avatar's head relative to the body, in degrees.

headYaw number

The yaw of the avatar's head relative to the body, in degrees.

headRoll number

The roll of the avatar's head relative to the body, in degrees.

velocity Vec3

The linear velocity of the avatar.

angularVelocity Vec3

The angular velocity of the avatar.

sessionUUID Uuid

The avatar's session ID.

displayName string

The avatar's display name.

sessionDisplayName string

The avatar's display name, sanitized and versioned, as defined by the avatar mixer. It is unique among all avatars present in the domain at the time.

isReplicated boolean

Deprecated: This property is deprecated and will be removed.

lookAtSnappingEnabled boolean

true if the avatar's eyes snap to look at another avatar's eyes when the other avatar is in the line of sight and also has lookAtSnappingEnabled == true.

skeletonModelURL string

The avatar's FST file.

attachmentData Array.<AttachmentData>

Information on the avatar's attachments.

Deprecated: This property is deprecated and will be removed. Use avatar entities instead.

jointNames Array.<string>

The list of joints in the avatar model.

audioLoudness number

The instantaneous loudness of the audio input that the avatar is injecting into the domain.

audioAverageLoudness number

The rolling average loudness of the audio input that the avatar is injecting into the domain.

sensorToWorldMatrix Mat4

The scale, rotation, and translation transform from the user's real world to the avatar's size, orientation, and position in the virtual world.

controllerLeftHandMatrix Mat4

The rotation and translation of the left hand controller relative to the avatar.

controllerRightHandMatrix Mat4

The rotation and translation of the right hand controller relative to the avatar.

skeletonOffset Vec3

The rendering offset of the avatar.

Methods

Name Return Value Summary
getAbsoluteJointRotationInObjectFrame Quat

Gets the rotation of a joint relative to the avatar.

getAbsoluteJointTranslationInObjectFrame Vec3

Gets the translation of a joint relative to the avatar.

getAcceleration Vec3

Gets the current acceleration of the avatar.

getAttachmentData Array.<AttachmentData>

Gets information about the models currently attached to the avatar.

Deprecated: This function is deprecated and will be removed. Use avatar entities instead.

getDefaultJointRotation Quat

Gets the default rotation of a joint in the avatar relative to its parent.

For information on the joint hierarchy used, see Avatar Standards.

getDefaultJointTranslation Vec3

Gets the default translation of a joint in the avatar relative to its parent, in model coordinates.

Warning: These coordinates are not necessarily in meters.

For information on the joint hierarchy used, see Avatar Standards.

getHandState HandState | number

Gets the pointing state of the hands to control where the laser emanates from. If the right index finger is pointing, the laser emanates from the tip of that finger, otherwise it emanates from the palm.

getJointIndex number

Gets the joint index for a named joint. The joint index value is the position of the joint in the array returned by {@linkScriptAvatar.getJointNames}.

getJointNames Array.<string>

Gets the names of all the joints in the avatar.

getJointPosition Vec3

Gets the position of a joint in the avatar.

getJointPosition Vec3

Gets the position of a joint in the current avatar.

getJointRotation Quat

Gets the rotation of a joint relative to its parent. For information on the joint hierarchy used, see Avatar Standards.

getJointRotation Quat

Gets the rotation of a joint relative to its parent. For information on the joint hierarchy used, see Avatar Standards.

getJointRotations Array.<Quat>

Gets the rotations of all joints in the avatar. Each joint's rotation is relative to its parent joint.

getJointTranslation Vec3

Gets the translation of a joint relative to its parent, in model coordinates.

Warning: These coordinates are not necessarily in meters.

For information on the joint hierarchy used, see Avatar Standards.

getJointTranslation Vec3

Gets the translation of a joint relative to its parent, in model coordinates.

Warning: These coordinates are not necessarily in meters.

For information on the joint hierarchy used, see Avatar Standards.

getJointTranslations Array.<Vec3>

Gets the translations of all joints in the avatar. Each joint's translation is relative to its parent joint, in model coordinates.

Warning: These coordinates are not necessarily in meters.

getLeftPalmPosition Vec3

Gets the position of the left palm in world coordinates.

getLeftPalmPosition Vec3

Gets the position of the right palm in world coordinates.

getLeftPalmRotation Quat

Gets the rotation of the left palm in world coordinates.

getLeftPalmRotation Quat

Gets the rotation of the right palm in world coordinates.

getNeckPosition Vec3

Gets the position of the current avatar's neck in world coordinates.

getParentID Uuid

Gets the ID of the entity or avatar that the avatar is parented to.

getParentJointIndex number

Gets the joint of the entity or avatar that the avatar is parented to.

getSimulationRate number

Deprecated: This function is deprecated and will be removed.

getSkeleton Array.<SkeletonJoint>

Gets information on all the joints in the avatar's skeleton.

getSkeletonOffset Vec3

Gets the offset applied to the avatar for rendering.

isJointDataValid boolean

Checks that the data for a joint are valid.

Signals

Name Summary
displayNameChanged

Triggered when the avatar's displayName property value changes.

lookAtSnappingChanged

Triggered when the avatar's lookAtSnappingEnabled property value changes.

sessionDisplayNameChanged

Triggered when the avatar's sessionDisplayName property value changes.

skeletonModelURLChanged

Triggered when the avatar's model (i.e., skeletonModelURL property value) changes.

Method Details

(static) getAbsoluteJointRotationInObjectFrame( index ) → {Quat}
Returns: The rotation of the joint relative to the avatar, or Quat.IDENTITY if the avatar data aren't available.

Gets the rotation of a joint relative to the avatar.

Parameters

Name Type Description
index number

The index of the joint.

(static) getAbsoluteJointTranslationInObjectFrame( index ) → {Vec3}
Returns: The translation of the joint relative to the avatar, or Vec3.ZERO if the avatar data aren't available.

Gets the translation of a joint relative to the avatar.

Parameters

Name Type Description
index number

The index of the joint.

(static) getAcceleration( ) → {Vec3}
Returns: The current acceleration of the avatar, or Vec3.ZERO if avatar data aren't available..

Gets the current acceleration of the avatar.

(static) getAttachmentData( ) → {Array.<AttachmentData>}
Returns: Information about all models attached to the avatar, or [] if the avatar data aren't available.

Gets information about the models currently attached to the avatar.

Deprecated: This function is deprecated and will be removed. Use avatar entities instead.

(static) getDefaultJointRotation( index ) → {Quat}
Returns: The default rotation of the joint if avatar data are available and the joint index is valid, otherwise Quat.IDENTITY.

Gets the default rotation of a joint in the avatar relative to its parent.

For information on the joint hierarchy used, see Avatar Standards.

Parameters

Name Type Description
index number

The joint index.

(static) getDefaultJointTranslation( index ) → {Vec3}
Returns: The default translation of the joint (in model coordinates) if avatar data are available and the joint index is valid, otherwise Vec3.ZERO.

Gets the default translation of a joint in the avatar relative to its parent, in model coordinates.

Warning: These coordinates are not necessarily in meters.

For information on the joint hierarchy used, see Avatar Standards.

Parameters

Name Type Description
index number

The joint index.

(static) getHandState( ) → {HandState|number}
Returns: The pointing state of the hand, or -1 if the avatar data aren't available.

Gets the pointing state of the hands to control where the laser emanates from. If the right index finger is pointing, the laser emanates from the tip of that finger, otherwise it emanates from the palm.

(static) getJointIndex( name ) → {number}
Returns: The index of the joint if valid and avatar data are available, otherwise -1.

Gets the joint index for a named joint. The joint index value is the position of the joint in the array returned by {@linkScriptAvatar.getJointNames}.

Parameters

Name Type Description
name string

The name of the joint.

(static) getJointNames( ) → {Array.<string>}
Returns: The joint names, or [] if the avatar data aren't available.

Gets the names of all the joints in the avatar.

(static) getJointPosition( index ) → {Vec3}
Returns: The position of the joint in world coordinates, or Vec3.ZERO if avatar data aren't available.

Gets the position of a joint in the avatar.

Parameters

Name Type Description
index number

The index of the joint.

(static) getJointPosition( name ) → {Vec3}
Returns: The position of the joint in world coordinates, or Vec3.ZERO if avatar data aren't available.

Gets the position of a joint in the current avatar.

Parameters

Name Type Description
name string

The name of the joint.

(static) getJointRotation( index ) → {Quat}
Returns: The rotation of the joint relative to its parent, or Quat.IDENTITY if the avatar data aren't available.

Gets the rotation of a joint relative to its parent. For information on the joint hierarchy used, see Avatar Standards.

Parameters

Name Type Description
index number

The index of the joint.

(static) getJointRotation( name ) → {Quat}
Returns: The rotation of the joint relative to its parent, or Quat.IDENTITY if the avatar data aren't available.

Gets the rotation of a joint relative to its parent. For information on the joint hierarchy used, see Avatar Standards.

Parameters

Name Type Description
name string

The name of the joint.

(static) getJointRotations( ) → {Array.<Quat>}
Returns: The rotations of all joints relative to each's parent, or [] if the avatar data aren't available. The values are in the same order as the array returned by ScriptAvatar.getJointNames.

Gets the rotations of all joints in the avatar. Each joint's rotation is relative to its parent joint.

(static) getJointTranslation( index ) → {Vec3}
Returns: The translation of the joint relative to its parent, in model coordinates, or Vec3.ZERO if the avatar data aren't available.

Gets the translation of a joint relative to its parent, in model coordinates.

Warning: These coordinates are not necessarily in meters.

For information on the joint hierarchy used, see Avatar Standards.

Parameters

Name Type Description
index number

The index of the joint.

(static) getJointTranslation( name ) → {Vec3}
Returns: The translation of the joint relative to its parent, in model coordinates, or Vec3.ZERO if the avatar data aren't available.

Gets the translation of a joint relative to its parent, in model coordinates.

Warning: These coordinates are not necessarily in meters.

For information on the joint hierarchy used, see Avatar Standards.

Parameters

Name Type Description
name number

The name of the joint.

(static) getJointTranslations( ) → {Array.<Vec3>}
Returns: The translations of all joints relative to each's parent, in model coordinates, or [] if the avatar data aren't available. The values are in the same order as the array returned by ScriptAvatar.getJointNames.

Gets the translations of all joints in the avatar. Each joint's translation is relative to its parent joint, in model coordinates.

Warning: These coordinates are not necessarily in meters.

(static) getLeftPalmPosition( ) → {Vec3}
Returns: The position of the left palm in world coordinates, or Vec3.ZERO if avatar data aren't available.

Gets the position of the left palm in world coordinates.

(static) getLeftPalmPosition( ) → {Vec3}
Returns: The position of the right palm in world coordinates, or Vec3.ZERO if avatar data aren't available.

Gets the position of the right palm in world coordinates.

(static) getLeftPalmRotation( ) → {Quat}
Returns: The rotation of the left palm in world coordinates, or Quat.IDENTITY if the avatar data aren't available.

Gets the rotation of the left palm in world coordinates.

(static) getLeftPalmRotation( ) → {Quat}
Returns: The rotation of the right palm in world coordinates, or Quat.IDENTITY if the avatar data aren't available.

Gets the rotation of the right palm in world coordinates.

(static) getNeckPosition( ) → {Vec3}
Returns: The position of the neck in world coordinates, or Vec3.ZERO if avatar data aren't available.

Gets the position of the current avatar's neck in world coordinates.

(static) getParentID( ) → {Uuid}
Returns: The ID of the entity or avatar that the avatar is parented to. Uuid.NULL if not parented or avatar data aren't available.

Gets the ID of the entity or avatar that the avatar is parented to.

(static) getParentJointIndex( ) → {number}
Returns: The joint of the entity or avatar that the avatar is parented to. 65535 or -1 if parented to the entity or avatar's position and orientation rather than a joint, or avatar data aren't available.

Gets the joint of the entity or avatar that the avatar is parented to.

(static) getSimulationRate( rateNameopt ) → {number}
Returns: Simulation rate in Hz, or 0.0 if avatar data aren't available.

Deprecated: This function is deprecated and will be removed.

Parameters

Name Type Attributes Default Value Description
rateName AvatarSimulationRate <optional>
""

Rate name.

(static) getSkeleton( ) → {Array.<SkeletonJoint>}
Returns: Information about each joint in the avatar's skeleton.

Gets information on all the joints in the avatar's skeleton.

(static) getSkeletonOffset( ) → {Vec3}
Returns: The skeleton offset if avatar data are available, otherwise Vec3.ZERO.

Gets the offset applied to the avatar for rendering.

(static) isJointDataValid( index ) → {boolean}
Returns: true if the joint data are valid, false if not or the avatar data aren't available.

Checks that the data for a joint are valid.

Parameters

Name Type Description
index number

The index of the joint.

Signal Details

displayNameChanged( )
Returns: Signal

Triggered when the avatar's displayName property value changes.

lookAtSnappingChanged( enabled )
Returns: Signal

Triggered when the avatar's lookAtSnappingEnabled property value changes.

Parameters

Name Type Description
enabled boolean

true if look-at snapping is enabled, false if not.

sessionDisplayNameChanged( )
Returns: Signal

Triggered when the avatar's sessionDisplayName property value changes.

skeletonModelURLChanged( )
Returns: Signal

Triggered when the avatar's model (i.e., skeletonModelURL property value) changes.