Skip to content

Avatar(key) ⇒ THREE.Object3D ​

Uva supports full VR IK for VRM, Mixamo and most humanoid avatars. All of the combined avatars in the scene use one single draw call.

js
// Load using imported object name
const avatar = await Avatar("Rindo.vrm", stream, cache);
// Load using an asset key
const avatar = await Avatar("a586e6....", stream, cache);

stream : optional boolean ​

By default this is true. This makes avatars use geometry streaming, so avatars are dynamically loaded and unloaded based on their distance from the camera, and frustum/occlusion culling. If you have scenes with more then 30 avatars this is recommended.

cache : optional boolean ​

If you are creating or cloning many identical avatars, this will keep the data in memory and speed up load time.

Functions ​

js
// This makes the current player use the avatar
avatar.equip()

world.add(avatar); // add avatar to the scene, for NPCs

// for WebXR this resets the avatar to standing, useful when switching between
// seated and standing playing environments
avatar.resetHeight();


// This makes avatars have idle animations while stationary,
// and walk/run animations when moving
avatar.animate();

// Make an avatar walk/run to a new location
avatar.moveTo(destination : new THREE.Vector3(0, 0, 5), speed : 1 default);

Properties ​

js

// Whether the avatar is currently visible (not occlusion or frustum culled)
avatar.inView : boolean

// When true, avatars do not compute physics, animation or bone matrix updates
// when they are not in view. Only their root transform is updated.
avatar.cullCPU : boolean [default true]

// Whether to enable spring bone physics for the avatar
avatar.physics : boolean [default true]

// By default all avatars when animated will crouch or float depending on their
// position relative to the floor. This raycasts per avatar every frame,
// it's best to disable this if you don't need it
avatar.raycastFloor : boolean [default true]

Animations ​

You can load any mixamo animation, docs coming soon.

Default animations: ​

js
avatar.playAnimation("samba");

// You can replace 'samba' with any of:
hipHopDance;
jump1;
robotDance;
singing;
swimming;
floating;
flair;
situps;
catwalk;
ymca;
walking1;
idleThinking;
standingUp;
sitting1;
running;
sittingIdle;
layingShrug;
idle3;
layingIdle;
jumpingJacks;
jogging;
layingHandMove;
jump2;
idle2;
fastRun;
falling;
dancing;
burpee;
chickenDance;
idleYawn;
macarena;
idle1;
idleHappy;
idleTalking;
sittingTalking;
samba;
idleLookingAround;
hokeyPokey;

idleLookAtWatch,
climbWall,
catwalkNeutral,
laughing,
talking1,
talking2,
shy,
excited,
headNod,
headNod2,
idleUsingTablet,
idleLookDown,