Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
66 views
in Technique[技术] by (71.8m points)

javascript - Upload a .json file in THREE.js

In three.js, I am trying to import a arrow json file, apon loading it I get this error

This is the json loader class I made:

class jsonFileLoader {
      readUrl (url) {
        this.rawdata = fs.readFileSync(url);
          return JSON.parse(this.rawdata);
      }
    }

and here is the code that loads the json file:

let JsonLoader = new jsonFileLoader();
let loader = new THREE.ObjectLoader();
let jsonData = JsonLoader.readUrl('src/mesh/arrow.json');
let arrowMesh = loader.parse(jsonData);

scene.add( arrowMesh );

Here is my Code sandbox

question from:https://stackoverflow.com/questions/65855278/upload-a-json-file-in-three-js

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...