Search code examples
node.jsaframegltf

aframe doesn't see embed .gltf scene inside <a-gltf-model/> -- 404 Not found. (through the node.js)


aframe doesn't see embed .gltf scene inside 'a-gltf-model' -- 404 Not found. (through the node.js). But if i put src into the 'a-emity' -- scene is on the page somewhere on rainbow with width/height 0/0. Position doesn't help. Starter scene (inline) is fine.

So, i have two files in root, first is 'index.js':

var express = require('express');
var app = express();
var path = require("path");

app.get('/', function (req, res) {
    res.sendFile(path.join('C:/web/index.html'));
});
app.listen(3000, function () {
  console.log('Example app listening on port 3000!');
});



And, here is content of 'index.html':

<!DOCTYPE html>
    <html>
      <head>
        <title>test aframe scene</title>
        <script src="https://aframe.io/releases/0.8.0/aframe.min.js"></script>
      </head>
      <body>
        <a-scene>
          <a-gltf-model src="scene/archilogic/export.gltf"></a-gltf-model>
        </a-scene>
      </body>
    </html>



p.s. sry, i'm just in the beginning, this is test quest, i was working with Blender before. Original scene here


Solution

  • This error means that your model (or some part of it) is not where your code says it is; there is little we can do to help without the full code. You can also review A-Frame docs on 3d models and hosting.

    EDIT: Now that you've posted some code, note that your Express server only takes requests on the / URL. You will need to set it up to serve additional files if you want to load images and models through it. From Serving Static Files in Express:

    app.use(express.static('C:/web'))
    

    All of your files should then be put in that folder.

    Also note that Archilogic (the source of this glTF file) uses an older version of glTF not compatible with recent A-Frame versions. If you can't see the model here, it won't appear in A-Frame. You need glTF 2.0.