IReadOnlyAvatar

Actor Service

Interface

Properties

airControl

How much control the player has over the character while in the air. A value of 0 means no control, 1 means full control.

bodyMaterials

Returns a collection of all materials used on the avatar's body. This can be used to change the appearance of the avatar.

displayName

The display name shown in the nametag above the avatar's head.

fallingGravityMultiplier

Multiplier on top of the default gravity settings for the space just for the local avatar while falling. This stacks on top of gravityMultiplier. This is useful for making the avatar fall faster than they jump.

gravityMultiplier

Multiplier on top of the default gravity settings for the space just for the local avatar.

groundFriction

Contribution of how much ground friction to apply to the character. A higher value will give the avatar more grip resulting in higher acceleration. This does not affect the avatar's maximum movement speed. Values should be between 0 and 1.

isBodyLoaded

Whether the avatar body is fully loaded. When users join a space, their avatar body is not immediately loaded. This property will be false until the avatar body is loaded. It's also possible for users to switch their avatars on the fly, so this property may change at any time. Use the onAvatarLoadComplete and onAvatarBeforeUnload event to be notified when the avatar body is loaded or unloaded.

isGrounded

Whether the avatar is currently grounded (the feet are touching the ground)

jumpHeight

The height in meters that the avatar can jump

maxJumpCount

Maximum number of times that the avatar can jump in a row before touching the ground.

nametagBarValue

Optional nametag bar value shown in the nametag above the avatar's head.

nametagBarVisible

Whether the nametag bar is visible.

nametagSubtext

An optional subtext shown in the nametag above the avatar's head.

position

The current position of the avatar's visual representation in the scene. This is the position of the avatar at the feet.

ragdollPhysicsActive

Is ragdoll physics currently active for the avatar?

ragdollVelocity

The current velocity of the avatar's ragdoll body.

rotation

The orientation of the avatar's visual representation in the scene. Currently this is always locked to Y-up.

runSpeed

The running speed of the avatar in meters per second.

useVariableHeightJump

When enabled, jump is higher depending on how long jump button is held down. Currently variable jump height may result in a slightly higher jumpHeight

velocity

The current velocity of the avatar

visibleLocally

Whether the avatar is visible in the scene.

visibleRemotely

Whether the avatar is visible in the scene to other remote users.

walkSpeed

The walking speed of the avatar in meters per second.

Methods

GetAvatarBoneTransform(HumanBodyBones)

Get the transform of a bone in the avatar's body.

Events

onAvatarBeforeUnload

Event that triggers when the avatar is about to be unloaded. If the avatar is owned by an actor, this may be because the actor has changed their avatar, or because the actor is leaving or disconnecting. This can be used to "deconstruct" anything that was created in the onAvatarLoadComplete event. isBodyLoaded will be set to false after this event is triggered.

onAvatarLoadComplete

Event that triggers when the avatar has finished loading. isBodyLoaded will be set to true before this event is triggered.

onColliderHit

Event that is triggered when the avatar's collider hits another collider.

onEmote

Event that is triggered when an emote avatar animation is started. Note that this doesn't trigger immediately when PlayEmote is called, but when the animation is loaded (asynchronously) and started.

onIsGroundedChanged

Event that is triggered when the avatar's grounded state changes (isGrounded)

onJump

Event that is triggered when the avatar starts to jump

onLanded

Event that is triggered when the avatar lands on the ground

onRespawned

Event that triggers when the avatar is respawned. Respawn can happen when:

  • A user's avatar enters a space and is spawned for the first time
  • An avatar is explicitly respawned with Respawn
  • An avatar goes out of bounds

For avatars created explicitly through SpawnAvatar this event will not trigger

Inherited Members

Equals(IAvatar)
Equals(IReadOnlyAvatar)
isDisposed

Returns true when the component or its parent space object has been destroyed.

spaceObject

The space object the component is attached to.

spaceObjectID

The id of the spaceObject the component is attached to.