I’m facing an issue when playing animation to multiplayer characters . I created a OnlinePlayers entity and attach the script that add new players when joining the photon room,
This code below is called when new player joins the room
OnlinePlayer.prototype.create_player_model = function (data, userID) {
let url = "https://models.readyplayer.me/examplemodel.glb";
let filename = 'model_glb';
var file = {
url: url,
filename: filename
};
var player_entity = new pc.Entity();
var asset = new pc.Asset(filename, 'container', file, null);
asset.once('load', function (glbData) {
var renderRootEntity = glbData.resource.instantiateRenderEntity();
player_entity.addChild(renderRootEntity);
player_entity.setPosition(data.x, 0.25, data.z);
console.log("this.entity : ", this.entity.anim);
player_entity.addComponent("anim", this.entity.anim);
console.log("player_entity : ", player_entity.anim);
player_entity.anim.baseLayer.play("OnlineIdle");
this.app.root.addChild(player_entity);
this.player_entities[userID] = player_entity;
}.bind(this));
app.assets.add(asset);
app.assets.load(asset);
};
When I console this line "console.log("player_entity : “, player_entity.anim);” the anim component is displayed in console with “OnlineIdle” animation in it but model loaded in the scene is not playing the animation .
What is the issue here? I don’t get any warning or error in console either. What is happen here?