Load model via string variable

Hi there!

I want to load my models in a more dynamically way via a txt file that contains the urls to the models.

So I’m trying to load my models via string variables containing the url that comes from a XMLHttpRequest of the txt file, instead of declaring the actual url in the load function.

Somehow this doesn’t work, can somebody help? :slight_smile:

This works:
var path = "https://threejs.org/examples/models/fbx/Samba Dancing.fbx";

1 Like

Thank you! If I try the same with GLTF I get a strange error.

Can you help? :slight_smile:

These lines will help:

camera.position.set(0, 0, 10);
camera.lookAt(scene.position);
  1. Your camera is not looking at the model, which is at the center of the scene. The camera is at [0, 80, 150] and looks at the global direction [0, 0, -1]. It’s far above the object and thus the object is not in the camera view/frustum.
  2. Your camera is far from the model, so the model is too small on the screen. Put it closer to the object.
1 Like

Thank you for this :slight_smile:
But why do it get this error: ‘THREE.WebGLProgram: gl.getProgramInfoLog() C:\fakepath(246,23-154): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them’?