IAvatarService

csharp
public interface IAvatarService

Namespace NodeWorld.Core.

Loads and shows the avatars: the local player's and those of the other players.

Properties

HasLocalAvatar

csharp
bool HasLocalAvatar { get; }

The local player has an avatar.

Methods

SetRemoteAvatarAudible

csharp
void SetRemoteAvatarAudible(uint playerId, bool audible)

Mutes or unmutes, for the local player only, every AudioSource of that remote player's avatar (kept across avatar changes).

LoadPlaceholder

csharp
void LoadPlaceholder()

Shows the default avatar while the player's own loads.

LoadAvatar

csharp
void LoadAvatar(string avatarId)

Loads the local player's avatar avatarId and puts it on.

ClearAvatar

csharp
void ClearAvatar()

Removes the local player's avatar.

TeleportLocalAvatar

csharp
void TeleportLocalAvatar(Vector3 position, Quaternion rotation)

Moves the local player's avatar to position, facing rotation.

SetSeatedMode

csharp
void SetSeatedMode(bool seated)

Turns seated mode on or off for the local player's avatar.

SpawnRemoteAvatar

csharp
UniTask SpawnRemoteAvatar(uint playerId, string userId, string displayName, string avatarId, string platform)

Spawn a remote player's avatar, using the placeholder while custom assets load.

SwapRemoteAvatar

csharp
UniTask SwapRemoteAvatar(uint playerId, string avatarId)

Swap an existing remote player's avatar.

DespawnRemoteAvatar

csharp
void DespawnRemoteAvatar(uint playerId)

Despawn a remote player's avatar.

DespawnAllRemoteAvatars

csharp
void DespawnAllRemoteAvatars()

Despawn all remote avatars (e.g. on disconnect or world change).

GetRemoteAvatarTransform

csharp
Transform GetRemoteAvatarTransform(uint playerId)

Returns the root Transform of a remote player's avatar, or null if not found.

GetRemoteAvatarVoiceTransform

csharp
Transform GetRemoteAvatarVoiceTransform(uint playerId)

Returns the preferred voice origin for a remote player, usually near the head/mouth.

FeedLocalVisemePcm

csharp
void FeedLocalVisemePcm(float[] pcm, int sampleCount, int channels)

Feed raw local microphone PCM to the active local avatar viseme driver.

FeedRemoteVisemePcm

csharp
void FeedRemoteVisemePcm(uint playerId, float[] pcm, int sampleCount, int channels)

Feed decoded remote player PCM to that player's avatar viseme driver.

UpdateRemotePlayerState

csharp
void UpdateRemotePlayerState(uint playerId, Vector3 position, Quaternion rotation, Vector3[] bonePositions, Quaternion[] boneRotations)

Update a remote player's full pose from network state.

CaptureLocalBoneSnapshot

csharp
BoneSnapshot CaptureLocalBoneSnapshot()

Capture the local player's current bone world-space transforms. Returns an invalid snapshot if no local avatar is active.

Events

OnLocalAvatarReady

csharp
event Action OnLocalAvatarReady

Raised when the local player's avatar is loaded and shown.

OnRemoteAvatarSpawned

csharp
event Action<uint> OnRemoteAvatarSpawned

Raised when another player's avatar is shown (their player ID).

OnRemoteAvatarDespawned

csharp
event Action<uint> OnRemoteAvatarDespawned

Raised when another player's avatar is removed (their player ID).