Hi everyone!
I rarely ask in forums, but Im having deep troubles with the materials of a GLB character from quaternius(dot)com (Rogue character from the 3D RPG character collection). Importing the model works fine but the material is not showing.
To be specific this is the model in glb format:
and here is the PNG texture/material (I don’t think this is necessary for GLB):
here is the snippet of my code for loading the model
async _loadPlayerAssets(scene) {
async function loadPlayer() {
// create collider for the collision mesh of player
const outer = MeshBuilder.CreateBox('outer', { width: 2, depth: 1, height: 3 }, scene);
outer.isVisible = false;
outer.isPickable = false;
outer.checkCollisions = true;
// move box collider to the bottom to match player mesh
outer.bakeTransformIntoVertices(Matrix.Translation(0, 1.5, 0));
// for collisions (?)
outer.ellipsoid = new Vector3(1, 1.5, 1);
outer.ellipsoidOffset = new Vector3(0, 1.5, 0);
outer.rotationQuaternion = new Quaternion(0, 1, 0, 0) // back of the player
return SceneLoader.ImportMeshAsync(null, './models/', 'rogue.glb', scene).then((res) => {
const root = res.meshes[0];
// actual player mesh
const body = root;
body.parent = outer;
// prevent self raycast
body.isPickable = false;
body.getChildMeshes().forEach(element => {
element.isPickable = false;
});
// let rougeDaggerTexture = new StandardMaterial('Rouge_Dagger_Texture', this._scene);
return {
mesh: outer,
animationGroups: res.animationGroups
}
});
}
return loadPlayer().then((assets) => {
this.assets = assets;
})
}
From what I know GLB files come with the material applied already, so Im not sure if its the code or the GLB file that’s not working.