OBJ Loader not working

I want to load the ninja OBJ file from threejs/examples/models/obj/ninja but it doesn’t seem to be working, see my code here: Glitch :・゚✧ any help would be appreciated

Unfortunately, this particular model is not properly centered. Try to translate the model in the onLoad() callback and move the camera a bit away from the plane. Use the following to move the model into your viewing area.

root.position.y -= 160;

Thanks, it’s working now, how do I add texture to the model like in the example below?


Have you tried to adapt the code from the example? Remember, it’s open-source :wink: .

I’ve managed to get it working but can’t figure out how to add a background, see code here: Glitch :・゚✧


this is the background I want to add, it’s called ‘venice sunset’:

I think you should find a solution for this issue in your other topic: Damaged Battle Helmet

I’ve already tried replacing the scene.background with an envmap but it doesn’t work

     {
            const loader = new THREE.TextureLoader();
            const texture = loader.load(
            'https://cdn.glitch.com/0f2dd307-0d28-4fe9-9ef9-db84277033dd%2Fvenice_sunset.jpg?v=1620758317378',
            () => {
            const rt = new THREE.WebGLCubeRenderTarget(texture.image.height);
            rt.fromEquirectangularTexture(renderer, texture);
            scene.background = rt.texture;
            scene.environment = rt.texture
          });
      }