Skip to main content

High Fidelity API Reference

Tools Used: JavaScript, JSDoc, GitHub Pages, Markdown, HTML, CSS


MyAvatar

Your avatar is your in-world representation of you. The MyAvatar API is used to manipulate the avatar. For example, you can customize the avatar's appearance, run custom avatar animations, change the avatar's position within the domain, or manage the avatar's collisions with the environment and other avatars.

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


Properties

NameTypeSummary

position

Vec3

The position of the avatar.

scale

number

The scale of the avatar. The value can be set to anything between 0.005 and 1000.0.

Default Value: 1.0

density

number

The density of the avatar in kg/m3. The density is used to work out its mass in the application of physics. Read-only.

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.

orientation

Quat

The orientation of the avatar.

headOrientation

Quat

The orientation of the avatar's head.

headPitch

number

The rotation about an axis running from ear to ear of the avatar's head. Pitch is sometimes called "elevation".

headYaw

number

The rotation left or right about an axis running from the base to the crown of the avatar's head. Yaw is sometimes called "heading".

headRoll

number

The rotation about an axis running from the nose to the back of the avatar's head. Roll is sometimes called "bank".

velocity

Vec3

The current velocity of the avatar.

displayName

string

The avatar's display name.

sessionDisplayName

string

displayName's sanitized and default version defined by the avatar mixer rather than Interface clients. The result is unique among all avatars present in the domain at the time.

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 current avatar model. Read-only.

sessionUUID

Uuid

Unique ID of the avatar in the domain. Read-only.

leftHandPosition

Vec3

The position of the left hand in avatar coordinates if it's being positioned by controllers, otherwise Vec3.ZERO. Read-only.

rightHandPosition

Vec3

The position of the right hand in avatar coordinates if it's being positioned by controllers, otherwise Vec3.ZERO. Read-only.

collisionsEnabled

boolean

Set to true to enable the avatar to collide with the environment, false to disable collisions with the environment. May return true even though the value was set false because the zone may disallow collisionless avatars.

userHeight

number

The height of the user in sensor space.

Default Value: 1.75

walkBackwardSpeed

number

The walk backward speed of your avatar.

sprintSpeed

number

The sprint (run) speed of your avatar.

isInSittingState

number

true if the user wearing the HMD is determined to be sitting (avatar leaning is disabled, recentering is enabled), false if the user wearing the HMD is determined to be standing (avatar leaning is enabled, and avatar recenters if it leans too far). If userRecenterModel == 2 (i.e., auto) the property value automatically updates as the user sits or stands, unless isSitStandStateLocked == true. Setting the property value overrides the current sitting / standing state, which is updated when the user next sits or stands unless isSitStandStateLocked == true.


Methods

NameReturn ValueSummary

attach

None

Attaches a model to your avatar. For example, you can give your avatar a hat to wear, a guitar to hold, or a surfboard to stand on.

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

beginSit

None

Starts a sitting action for the avatar.

centerBody

None

Moves and orients the avatar, such that it is directly underneath the HMD, with toes pointed forward in the direction of the HMD.

clearJointData

None

Clears joint translations and rotations set by script for a specific joint. This restores all motion from the default animation system including inverse kinematics for that joint.

endSit

None

Ends a sitting action for the avatar.

getAcceleration

Vec3

Gets the current acceleration of the avatar.

getAvatarScale

number

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

getGravity

number

Sets the amount of gravity applied to the avatar in the y-axis direction. (Negative values are downward.) The default value is -5 m/s2.

getHeight

number

Gets the current height of the avatar. This height is only an estimate and might be incorrect for avatars that are missing standard joints.

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 MyAvatar.getJointNames.

getJointNames

Array.<string>

Gets the names of all the joints in the current 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.

getJointTranslation

Vec3

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

Warning: These coordinates are not necessarily in meters.

getParentID

Uuid

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

getSkeleton

Array.<MyAvatar.SkeletonJoint>

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

goToLocation

None

Moves the avatar to a new position and (optional) orientation in the domain.

grab

Uuid

Creates a new grab that grabs an entity.

increaseSize

None

Increases the avatar's scale by five percent, up to a minimum scale of 1000.

isFlying

boolean

Checks whether your avatar is flying.

isInAir

boolean

Checks whether your avatar is in the air.

isSeated

boolean

Gets whether the avatar is in a seated pose. The seated pose is set by calling the MyAvatar::beginSit method.

overrideAnimation

None

Overrides the default avatar animations.

pinJoint

boolean

Sets and locks a joint's position and orientation.

Note: Only works on the hips joint.

releaseGrab

None

Releases (deletes) a grab to stop grabbing an entity.

resetSize

None

Resets the avatar's scale back to the default scale of 1.0.

restoreAnimation

None

Restores the default animations.

setAvatarScale

None

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

setGravity

None

Sets the amount of gravity applied to the avatar in the y-axis direction. (Negative values are downward.)

setJointData

None

Sets a specific joint's rotation and position relative to its parent, in model coordinates.

Warning: These coordinates are not necessarily in meters.

setJointRotation

None

Sets a specific joint's rotation relative to its parent.

setJointTranslation

None

Sets a specific joint's translation relative to its parent, in model coordinates.

Warning: These coordinates are not necessarily in meters.

setParentID

None

Sets the ID of the entity of avatar that the avatar is parented to.

setSessionUUID

None

Deprecated: This function is deprecated and will be removed.

useFlow

None

Enables and disables flow simulation of physics on the avatar's hair, clothes, and body parts.


Signals

NameSummary

attachmentsChanged

Triggered when the a model is attached to or detached from one of the avatar's joints using one of attach or setAttachmentData.

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

collisionsEnabledChanged

Triggered when collisions with the environment are enabled or disabled.

collisionWithEntity

Triggered when the avatar collides with an entity.

displayNameChanged

Triggered when the avatar's displayName property value changes.

onLoadComplete

Triggered when the avatar's model finishes loading.

onLoadFailed

Triggered when the avatar's model has failed to load.

positionGoneTo

Triggered when the avatar has been moved to a new position by one of the MyAvatar "goTo" functions.

scaleChanged

Triggered when the avatar's size changes. This can be due to the user changing the size of their avatar or the domain limiting the size of their avatar.

sessionDisplayNameChanged

Triggered when the avatar's sessionDisplayName property value changes.

sessionUUIDChanged

Triggered when the avatar's sessionUUID property value changes.

skeletonChanged

Triggered when the avatar's model is changed.

sprintSpeedChanged

Triggered when the sprint (run) speed set changes.

walkBackwardSpeedChanged

Triggered when the walk backward speed set changes.

wentActive

Triggered when your avatar changes from being away to being active.

wentAway

Triggered when your avatar changes from being active to being away.


Type Definitions

AvatarEntityData

AvatarEntityData

Type: object

Information about an avatar entity.

Properties

PropertyTypeDescription

id

Uuid

Entity ID.

properties

Entities.EntityProperties

Entity properties.

FlowData

FlowData

Type: object

Flow options currently used in flow simulation.

Properties

NameTypeSummary

initialized

boolean

true if flow has been initialized for the current avatar, falseif it hasn't.

active

boolean

true if flow is enabled, false if it isn't.

colliding

boolean

true if collisions are enabled, falseif they aren't.

physicsData

Object.<GroupName, MyAvatar.FlowPhysicsData>

The physics configuration for each group of joints that has been configured.

threads

Object.<ThreadName, Array.<number>

The threads that have been configured, with the first joint's name as the ThreadName and value as an array of the indexes of all the joints in the thread.

FlowPhysicsData

FlowPhysicsData

Type: object

A set of physics options currently used in flow simulation.

Properties

NameTypeSummary

active

boolean

true to enable flow on the joint, otherwise false.

radius

number

The thickness of segments and knots. (Needed for collisions.)

gravity

number

Y-value of the gravity vector.

inertia

number

Rotational inertia multiplier.

damping

number

The amount of damping on joint oscillation.

stiffness

number

The stiffness of each thread.

delta

number

Delta time for every integration step.

jointIndices

Array.<number>

The indexes of the joints the options are applied to.

GoToProperties

GoToProperties

Type: object

A teleport target.

Properties

NameTypeAttributesSummary

position

Vec3

The avatar's new position.

orientation

Quat

<optional>

The avatar's new orientation.

LocomotionControlsMode

LocomotionControlsMode

Type: number

Locomotion control types.

Properties

ValueNameDescription

0

Default

Your walking speed is constant; it doesn't change depending on how far forward you push your controller's joystick. Fully pushing your joystick forward makes your avatar run.

1

Analog

Your walking speed changes in steps based on how far forward you push your controller's joystick. Fully pushing your joystick forward makes your avatar run.

2

AnalogPlus

Your walking speed changes proportionally to how far forward you push your controller's joystick. Fully pushing your joystick forward makes your avatar run.

SitStandModelType

SitStandModelType

Type: number

Specifies different avatar leaning and recentering behaviors.

Properties

ValueNameDescription

0

ForceSit

Assumes the user is seated in the real world. Disables avatar leaning regardless of what the avatar is doing in the virtual world (i.e., avatar always recenters).

1

ForceStand

Assumes the user is standing in the real world. Enables avatar leaning regardless of what the avatar is doing in the virtual world (i.e. avatar leans, then if leans too far it recenters).

2

Auto

Interface detects when the user is standing or seated in the real world. Avatar leaning is disabled when the user is sitting (i.e., avatar always recenters), and avatar leaning is enabled when the user is standing (i.e., avatar leans, then if leans too far it recenters).

SkeletonJoint

SkeletonJoint

Type: object

Information about a single joint in an avatar's skeleton hierarchy.

Properties

NameTypeSummary

name

string

Joint name.

index

number

Joint index.

parentIndex

number

Index of this joint's parent (-1 if no parent).


Method Details

attach

(static) attach( modelURL, jointNameopt, translationopt, rotationopt, scaleopt,
   isSoftopt, allowDuplicatesopt, useSavedopt )

Attaches a model to your avatar. For example, you can give your avatar a hat to wear, a guitar to hold, or a surfboard to stand on.

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

beginSit

(static) beginSit( position, rotation )

Starts a sitting action for the avatar.

Parameters

NameTypeDescription

position

Vec3

The point in space where the avatar will sit.

rotation

Quat

Initial absolute orientation of the avatar once is seated.

centerBody

(static) centerBody( )

Moves and orients the avatar, such that it is directly underneath the HMD, with toes pointed forward in the direction of the HMD.

clearJointData

(static) clearJointData( name )

Clears joint translations and rotations set by script for a specific joint. This restores all motion from the default animation system including inverse kinematics for that joint.

Note: This is slightly slower than the function variation that specifies the joint index.

Parameters

NameTypeDescription

name

string

The name of the joint.

Example: Offset and restore the position of your avatar's head
// Stretch your avatar's neck.
MyAvatar.setJointTranslation("Neck", Vec3.multiply(2, MyAvatar.getJointTranslation("Neck")));

// Restore your avatar's neck after 5s.
Script.setTimeout(function () {
MyAvatar.clearJointData("Neck");
}, 5000);

endSit

(static) endSit( position, rotation )

Ends a sitting action for the avatar.

Parameters

NameTypeDescription

position

Vec3

The position of the avatar when standing up.

rotation

Quat

The absolute rotation of the avatar once the sitting action ends.

getAcceleration

(static) getAcceleration( ) → { Vec3 }

Returns: The current acceleration of the avatar.

Gets the current acceleration of the avatar.

getAvatarScale

(static) getAvatarScale( ) → { number }

Returns: The target scale for the avatar, range 0.0051000.0.

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

getGravity

(static) getGravity( ) → { number }

Returns: The amount of gravity currently applied to the avatar, in m/s2.

Sets the amount of gravity applied to the avatar in the y-axis direction. (Negative values are downward.) The default value is -5 m/s2.

getHeight

(static) getHeight( ) → { number }

Returns: The height of the avatar.

Gets the current height of the avatar. This height is only an estimate and might be incorrect for avatars that are missing standard joints.

getJointIndex

(static) getJointIndex( name ) → { number }

Returns: The index of the joint if valid, 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 MyAvatar.getJointNames.

Parameters

NameTypeDescription

name

string

The name of the joint.

Example: Report the index of your avatar's left arm joint
print(JSON.stringify(MyAvatar.getJointNames()));

getJointNames

(static) getJointNames( ) → { Array.<string> }

Returns: The joint names.

Gets the names of all the joints in the current avatar.

Example: Report the names of all the joints in your current avatar
print(JSON.stringify(MyAvatar.getJointNames()));

getJointPosition

(static) getJointPosition( name ) → { Vec3 }

Returns: The position of the joint in world coordinates.

Gets the position of a joint in the current avatar.

Parameters

NameTypeDescription

name

string

The name of the joint.

Example: Report the position of your avatar's hips
print(JSON.stringify(MyAvatar.getJointPosition("Hips")));

getJointRotation

(static) getJointRotation( name ) → { Quat }

Returns: The rotation of the joint in world coordinates.

Gets the rotation of a joint relative to its parent.

Parameters

NameTypeDescription

name

string

The name of the joint.

Example: Report the rotation of your avatar's hips joint
print(JSON.stringify(MyAvatar.getJointRotation("Hips")));

getJointTranslation

(static) getJointTranslation( name ) → { Vec3 }

Returns: The translation of the joint relative to its parent, in model coordinates.

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

Warning: These coordinates are not necessarily in meters.

Parameters

NameTypeDescription

name

string

The name of the joint.

Example: Report the translation of your avatar's hips joint
print(JSON.stringify(MyAvatar.getJointRotation("Hips")));

getParentID

(static) getParentID( ) → { Uuid }

Returns: The ID of the entity or avatar that the avatar is parented to; if not parented, returns Uuid.NULL.

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

getSkeleton

(static) getSkeleton( ) → { Array.<MyAvatar.SkeletonJoint> }

Returns: Information about each joint in the avatar's skeleton.

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

goToLocation

(static) goToLocation( position, hasOrientationopt, orientationopt,
   shouldFaceLocationopt, withSafeLandingopt )

Moves the avatar to a new position and/or orientation in the domain.

Parameters

NameTypeAttributesDefault ValueDescription

position

Vec3

The new position for the avatar, in world coordinates.

hasOrientation

boolean

<optional>

false

Set to true to set the orientation of the avatar.

orientation

Quat

<optional>

Quat.IDENTITY

The new orientation for the avatar.

shouldFaceLocation

boolean

<optional>

false

Set to true to position the avatar a short distanceaway from

grab

(static) grab( targetID, parentJointIndex, offset, rotationalOffset ) → { Uuid }

Returns: The ID of the new grab.

Creates a new grab that grabs an entity.

Parameters

NameTypeDescription

targetID

Uuid

The ID of the entity to grab.

parentJointIndex

number

The avatar joint to use to grab the entity.

offset

Vec3

The target's local position relative to the joint.

rotationalOffset

Quat

The target's local rotation relative to the joint.

Example: Create and grab an entity for a short while
var entityPosition = Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: -5 }));
var entityRotation = MyAvatar.orientation;
var entityID = Entities.addEntity({
type: "Box",
position: entityPosition,
rotation: entityRotation,
dimensions: { x: 0.5, y: 0.5, z: 0.5 }
});
var rightHandJoint = MyAvatar.getJointIndex("RightHand");
var relativePosition = Entities.worldToLocalPosition(entityPosition, MyAvatar.SELF_ID, rightHandJoint);
var relativeRotation = Entities.worldToLocalRotation(entityRotation, MyAvatar.SELF_ID, rightHandJoint);
var grabID = MyAvatar.grab(entityID, rightHandJoint, relativePosition, relativeRotation);

Script.setTimeout(function () {
MyAvatar.releaseGrab(grabID);
Entities.deleteEntity(entityID);
}, 10000);

increaseSize

(static) increaseSize( )

Increases the avatar's scale by five percent, up to a minimum scale of 1000.

Example: Reset your avatar's size to default then grow it 5 times
MyAvatar.resetSize();

for (var i = 0; i &lt; 5; i++){
print("Growing by 5 percent");
MyAvatar.increaseSize();
}

isFlying

(static) isFlying( ) → { boolean }

Returns: true if your avatar is flying and not taking off or falling, false if not.

Checks whether your avatar is flying.

isInAir

(static) isInAir( ) → { boolean }

Returns: true if your avatar is taking off, flying, or falling, otherwise false because your avatar is on the ground.

Checks whether your avatar is in the air.

isSeated

(static) isSeated( ) → { boolean }

Returns: true if the avatar is in a seated pose.

Gets whether the avatar is in a seated pose. The seated pose is set by calling the MyAvatar.beginSit method.

overrideAnimation

(static) overrideAnimation( url, fps, loop, firstFrame, lastFrame )

Overrides the default avatar animations.

The avatar animation system includes a set of default animations along with rules for how those animations are blended together with procedural data (such as look at vectors, hand sensors etc.). overrideAnimation() is used to completely override all motion from the default animation system (including inverse kinematics for hand and head controllers) and play a set of specified animations. To end these animations and restore the default animations, use MyAvatar.restoreAnimation.

Note: When using pre-built animation data, it's critical that the joint orientation of the source animation and target rig are equivalent, since the animation data applies absolute values onto the joints. If the orientations are different, the avatar will move in unpredictable ways.

Parameters

NameTypeDescription

url

string

The URL to the animation file. Animation files may be in glTF orFBX format, but only need tocontain the avatar skeleton and animation data. glTF models maybe in JSON or binary format (".gltf" or ".glb" URLs respectively).

Warning: glTF animations currently do not always animate correctly.

fps

number

The frames per second (FPS) rate for the animation playback. 30FPS is normal speed.

loop

boolean

true if the animation should loop, false if it shouldn't.

firstFrame

number

The frame to start the animation at.

lastFrame

number

The frame to end the animation at.

Example: Play a clapping animation on your avatar for three seconds
var ANIM_URL = "https://s3.amazonaws.com/hifi-public/animations/ClapAnimations/ClapHands_Standing.fbx";
MyAvatar.overrideAnimation(ANIM_URL, 30, true, 0, 53);
Script.setTimeout(function () {
MyAvatar.restoreAnimation();
}, 3000);

pinJoint

(static) pinJoint( index, position, orientation ) → { boolean }

Returns: true if the joint was pinned, false if it wasn't.

Sets and locks a joint's position and orientation.

Note: Only works on the hips joint.

Parameters

NameTypeDescription

index

number

The index of the joint.

position

Vec3

The position of the joint in world coordinates.

orientation

Quat

The orientation of the joint in world coordinates.

releaseGrab

(static) releaseGrab( grabID )

Releases (deletes) a grab to stop grabbing an entity.

Parameters

NameTypeDescription

grabID

Uuid

The ID of the grab to release.

resetSize

(static) resetSize( )

Resets the avatar's scale back to the default scale of 1.0.

restoreAnimation

(static) restoreAnimation( )

Restores the default animations.

The avatar animation system includes a set of default animations along with rules for how those animations are blended together with procedural data (such as look at vectors, hand sensors etc.). Playing your own custom animations will override the default animations. restoreAnimation() is used to restore all motion from the default animation system including inverse kinematics for hand and head controllers. If you aren't currently playing an override animation, this function has no effect.

Example: Play a clapping animation on your avatar for three seconds
var ANIM_URL = "https://s3.amazonaws.com/hifi-public/animations/ClapAnimations/ClapHands_Standing.fbx";
MyAvatar.overrideAnimation(ANIM_URL, 30, true, 0, 53);
Script.setTimeout(function () {
MyAvatar.restoreAnimation();
}, 3000);

setAvatarScale

(static) setAvatarScale( scale )

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

Parameters

NameTypeDescription

scale

number

The target scale for the avatar, range 0.0051000.0.

setGravity

(static) setGravity( gravity )

Sets the amount of gravity applied to the avatar in the y-axis direction. (Negative values are downward.)

Parameters

NameTypeDescription

gravity

number

The amount of gravity to be applied to the avatar, in m/s2.

setJointData

(static) setJointData( name, rotation, translation )

Sets a specific joint's rotation and position relative to its parent, in model coordinates.

Warning: These coordinates are not necessarily in meters.

Setting joint data completely overrides/replaces all motion from the default animation system including inverse kinematics, but just for the specified joint. So for example, if you were to procedurally manipulate the finger joints, the avatar's hand and head would still do inverse kinematics properly. However, as soon as you start to manipulate joints in the inverse kinematics chain, the inverse kinematics might not function as you expect. For example, if you set the rotation of the elbow, the hand inverse kinematics position won't end up in the right place.

Parameters

NameTypeDescription

name

string

The name of the joint.

rotation

Quat

The rotation of the joint relative to its parent.

translation

Vec3

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

setJointRotation

(static) setJointRotation( name, rotation )

Sets a specific joint's rotation relative to its parent.

Setting joint data completely overrides/replaces all motion from the default animation system including inverse kinematics, but just for the specified joint. So for example, if you were to procedurally manipulate the finger joints, the avatar's hand and head would still do inverse kinematics properly. However, as soon as you start to manipulate joints in the inverse kinematics chain, the inverse kinematics might not function as you expect. For example, if you set the rotation of the elbow, the hand inverse kinematics position won't end up in the right place.

Parameters

NameTypeDescription

name

string

The name of the joint.

rotation

Quat

The rotation of the joint relative to its parent.

setJointTranslation

(static) setJointTranslation( name, translation )

Sets a specific joint's translation relative to its parent, in model coordinates.

Warning: These coordinates are not necessarily in meters.

Setting joint data completely overrides/replaces all motion from the default animation system including inverse kinematics, but just for the specified joint. So for example, if you were to procedurally manipulate the finger joints, the avatar's hand and head would still do inverse kinematics properly. However, as soon as you start to manipulate joints in the inverse kinematics chain, the inverse kinematics might not function as you expect. For example, if you set the rotation of the elbow, the hand inverse kinematics position won't end up in the right place.

Parameters

NameTypeDescription

name

string

The name of the joint.

translation

Vec3

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

Example: Stretch your avatar's neck

Depending on the avatar you are using, you will either see a gap between the head and body or you will see the neck stretched

// Stretch your avatar's neck.
MyAvatar.setJointTranslation("Neck", Vec3.multiply(2, MyAvatar.getJointTranslation("Neck")));

// Restore your avatar's neck after 5s.
Script.setTimeout(function () {
MyAvatar.clearJointData("Neck");
}, 5000);

setParentID

(static) setParentID( parentID )

Sets the ID of the entity of avatar that the avatar is parented to.

Parameters

NameTypeDescription

parentID

Uuid

The ID of the entity or avatar that the avatar should be parented to. Set to Uuid.NULL to unparent.

setSessionUUID

(static) setSessionUUID( sessionUUID )

Deprecated: This function is deprecated and will be removed.

useFlow

(static) useFlow( isActive, isCollidable, physicsConfigopt, collisionsConfigopt )

Enables and disables flow simulation of physics on the avatar's hair, clothes, and body parts.

Parameters

NameTypeAttributesDescription

isActive

boolean

true if flow simulation is enabled on the joint, false if it isn't.

isCollidable

boolean

true to enable collisions in the flow simulation, false to disable.


Signal Details

attachmentsChanged

attachmentsChanged( )

Returns: Signal

Triggered when the a model is attached to or detached from one of the avatar's joints using attach or setAttachmentData.

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

collisionsEnabledChanged

collisionsEnabledChanged( enabled )

Returns: Signal

Triggered when collisions with the environment are enabled or disabled.

Parameters

NameTypeDescription

enabled

boolean

true if collisions with the environment are enabled, false if they're not.

collisionWithEntity

collisionWithEntity( collision )

Returns: Signal

Triggered when the avatar collides with an entity.

Parameters

NameTypeDescription

collision

Collision

Details of the collision.

Example: Report each time your avatar collides with an entity
MyAvatar.collisionWithEntity.connect(function (collision) {
print("Your avatar collided with an entity.");
});

displayNameChanged

displayNameChanged( )

Returns: Signal

Triggered when the avatar's displayName property value changes.

Example: Report when your avatar display name changes
MyAvatar.displayNameChanged.connect(function () {
print("Avatar display name changed to: " + MyAvatar.displayName);
});

onLoadComplete

onLoadComplete( )

Returns: Signal

Triggered when the avatar's model finishes loading.

onLoadFailed

onLoadFailed( )

Returns: Signal

Triggered when the avatar's model has failed to load.

positionGoneTo

positionGoneTo( )

Returns: Signal

Triggered when the avatar has been moved to a new position by one of the MyAvatar "goTo" functions.

scaleChanged

scaleChanged( )

Returns: Signal

Triggered when the avatar's size changes. This can be due to the user changing the size of their avatar or the domain limiting the size of their avatar.

sessionDisplayNameChanged

sessionDisplayNameChanged( )

Returns: Signal

Triggered when the avatar's sessionDisplayName property value changes.

Example: Report when your avatar's session display name changes
MyAvatar.sessionDisplayNameChanged.connect(function () {
print("Avatar session display name changed to: " + MyAvatar.sessionDisplayName);
});

sessionUUIDChanged

sessionUUIDChanged( )

Returns: Signal

Triggered when the avatar's sessionUUID property value changes.

Example: Report when your avatar's session UUID changes
MyAvatar.sessionUUIDChanged.connect(function () {
print("Avatar session UUID changed to: " + MyAvatar.sessionUUID);
});

skeletonChanged

skeletonChanged( )

Returns: Signal

Triggered when the avatar's model (i.e., skeletonModelURL property) is changed.

sprintSpeedChanged

sprintSpeedChanged( speed )

Returns: Signal

Triggered when the sprint (run) speed set changes.

Parameters

NameTypeDescription

speed

number

The new sprint speed set for the current control scheme.

walkBackwardSpeedChanged

walkBackwardSpeedChanged( speed )

Returns: Signal

Triggered when the walk backward speed set changes.

Parameters

NameTypeDescription

speed

number

The new walk backward speed set for the current control scheme.

wentActive

wentActive( )

Returns: Signal

Triggered when your avatar changes from being away to being active.

wentAway

wentAway( )

Returns: Signal

Triggered when your avatar changes from being active to being away.

Example: Report when your avatar goes away
MyAvatar.wentAway.connect(function () {
print("My avatar went away");
});
// In desktop mode, pres the Esc key to go away.