Snippet3D ObjectChanging Avatar Appearance

Changing Avatar Appearance


change-avatar-appearance_result

You can make the playerโ€™s avatar invisible and add another object as a child of the player to create the appearance of changing the avatar.

โš ๏ธ

Make sure to add the avatar you want to change to the scene in advance.

const obj = WORLD.getObject("obj");  // Object to use for the new appearance
const btn = GUI.getObject('btn');
 
btn.onClick(function() {
    PLAYER.children[0].visible = false; // Hide the player avatar
    PLAYER.add(obj); // Add the object as a child of the player
    obj.position.set(0, 0.5, 0); // Set the object's position
})