What’s the best way to achieve this?
1)Do I import my character as a .glb with type container via:
var url = "Character.glb";
app.assets.loadFromUrl(url, "container", function(err, asset) {});
Or as an editor exported .json with type model via:
var url = "Character.json";
app.assets.loadFromUrl(url, "model", function(err, asset) {});
2)Do I download the animation from mixamo with or without skin?
This is what I’ve tried so far. The model is imported but I can’t get the animation to play.
var url = "Character.glb";
app.assets.loadFromUrl(url, "container", function(err, asset) {
Character = new pc.Entity("Character");
Character.addComponent("model", {
type: "asset",
asset: asset.resource.model,
castShadows: true
});
app.assets.loadFromUrl("IdleWithoutSkin.json", "animation", function(err, asset) {
Character.addComponent("animation", {
asset: "mixamo.com",
speed: 1,
loop: true
});
Character.animation.play("mixamo.com", 0.2);
console.log("playing"); //I get this in the console but the animation doesn't play.
});
Character.setLocalScale(0.018, 0.018, 0.018);
Character.setLocalPosition(0, -1.8, 0);
app.root.addChild(Character);
});
I even tried the above code with .json and imported that as type model, but even then I couldn’t get the animation to play.