I have a problem with loading glb object into scene. Object is showed without texture, in white color
THREE.GLTFLoader: Couldn’t load texture {“_h”: 1, “_i”: 2, “_j”: [Error: Creating blobs from ‘ArrayBuffer’ and ‘ArrayBufferView’ are not supported], “_k”: null}
This is the error from console when i add character to the scene.
import { Group, AnimationMixer, Clock } from ‘three’;
import { Asset } from ‘expo-asset’;
import { GLTFLoader } from ‘three/examples/jsm/loaders/GLTFLoader’;class Character extends Group {
private mixer: AnimationMixer | null = null;
private clock: Clock = new Clock();
private actions: { [key: string]: THREE.AnimationAction } = {};
private currentAnimationName: string | null = null;
private activeAction: THREE.AnimationAction | null = null;constructor() {
super();const loader = new GLTFLoader(); const modelLocation = Asset.fromModule(require(`./models/Soldier6.glb`)).uri; loader.load( modelLocation, (gltf) => { const modelWrapper = new Group(); // Wrapper to preserve root transform const character = gltf.scene; modelWrapper.add(character); this.mixer = new AnimationMixer(character); // Store all animations in a dictionary for easy access gltf.animations.forEach((clip) => { this.actions[clip.name] = this.mixer!.clipAction(clip); }); // Play the first animation by default if (gltf.animations.length > 0) { this.setActiveAnimation(gltf.animations[0].name); } this.add(modelWrapper); this.startAnimationLoop(); console.log("Animations " + gltf.animations.map(anim => anim.name).join(', ')); }, undefined, (error) => { console.error('An error occurred while loading the character model:', error); } );}
public setActiveAnimation(animationName: string) {
if (!this.mixer || !this.actions[animationName]) {
console.warn(Animation "${animationName}" not found.);
return;
}// Avoid restarting the same animation if (this.currentAnimationName === animationName) return; const newAction = this.actions[animationName]; // Crossfade from the current action to the new one if (this.activeAction) { this.activeAction.fadeOut(0.2); } newAction.reset().fadeIn(0.2).play(); this.activeAction = newAction; this.currentAnimationName = animationName;}
public update(delta: number) {
if (this.mixer) {
this.mixer.update(delta);
}
}
}export default Character;
What i am missing in order to display those objects propertly