Change Avatars Programatically
Control how users see and express themselves with the .changeAvatar() method on LocalPlayer
import { Script, Asset } from "playcanvas";
import { PlayerService } from "../@viverse/create-sdk.mjs";
export class VvSwitchAvatars extends Script {
static scriptName = "vvSwitchAvatars";
/**
* @attribute
* @type {Asset}
*/
vrmAsset = null;
initialize() {
this.playerService = new PlayerService();
this.playerService.localPlayer.changeAvatar(this.vrmAsset);
}
}


Last updated
Was this helpful?