Skip to main content

VRM Module

The Vrm class is the core module of @hmcs/sdk. It manages the full lifecycle of VRM 3D characters -- spawning, finding, animating, controlling expressions, handling pointer/drag events, lip-sync speech, and more.

import { Vrm, repeat, VrmEventSource } from "@hmcs/sdk";

Static Methods

MethodDescription
Vrm.spawnSpawn a new VRM from a MOD asset ID. Returns a Vrm instance.
Vrm.findByNameFind a VRM by its model name. Throws if not found.
Vrm.waitLoadByNameWait for a VRM to finish loading, then return it.
Vrm.findAllGet all loaded VRM instances as Vrm[].
Vrm.findAllEntitiesGet all loaded VRM entity IDs as number[].
Vrm.findAllDetailedGet detailed snapshots of all VRMs (state, transform, expressions, animations, persona).
Vrm.streamMetadataStream raw VrmMetadata for existing and future VRM instances.
Vrm.streamStream existing and future VRM instances as Vrm objects.

Instance Methods

MethodDescription
despawnRemove this VRM from the scene.
positionGet position in both screen (globalViewport) and world coordinates.
stateGet the current state string (e.g., "idle", "drag", "sitting").
setStateSet the character's state.
nameGet the VRM model name.
findBoneEntityFind the entity ID of a named bone (e.g., "head", "leftHand").
playVrmaPlay a VRMA animation with repeat, transition, and completion options.
stopVrmaStop a specific VRMA animation by asset ID.
listVrmaList all VRMA animations attached to this VRM.
vrmaStateGet the playback state of a specific animation (playing, speed, elapsed).
setVrmaSpeedChange the playback speed of an animation.
springBonesGet all spring bone chains (hair, clothing physics).
springBoneGet a specific spring bone chain by entity ID.
setSpringBoneUpdate spring bone physics properties (stiffness, drag, gravity).
expressionsGet all expressions and their current weights.
setExpressionsSet expression weights, replacing all previous overrides.
modifyExpressionsPartially update expression weights (other overrides remain).
clearExpressionsClear all expression overrides, returning control to VRMA animation.
modifyMouthSet mouth expressions for lip-sync (non-mouth overrides are preserved).
lookAtCursorMake the character's eyes follow the mouse cursor.
lookAtTargetMake the character look at a specific entity.
unlookDisable the look-at behavior.
personaGet the character's persona (profile, personality, OCEAN traits, metadata).
setPersonaSet the character's persona data.
speakWithTimelinePlay WAV audio with frame-synchronized expression keyframes for lip-sync.
eventsOpen a VrmEventSource for real-time event streaming.

repeat namespace

FunctionDescription
repeat.foreverLoop the animation indefinitely.
repeat.neverPlay the animation exactly once.
repeat.countPlay the animation a fixed number of times.

VrmEventSource

MethodDescription
VrmEventSource.onRegister an event listener.
VrmEventSource.closeClose the SSE connection.