cnzac
cnzac

Reputation: 435

THREE.JSONLoader Load external JSON file (NOT model)

I am trying to load a JSON file with THREE.JSONLoader. This file is not a JSON model but just a file with coordinates.

Ideally, I am trying to do this:

var loader = new THREE.JSONLoader(); loader.load("filename.json", function(result) { console.log(result) })

The "filename.json" file would just contain a JSON object that looks something like this: [{"x":0, "y": 1, "z":1}, {"x":0, "y": 1, "z":1}, ...]

Is there some way for me to load JSON this way in three? Thanks!!

Upvotes: 0

Views: 160

Answers (1)

Markus Tinnfält
Markus Tinnfält

Reputation: 187

Check out https://github.com/mrdoob/three.js/wiki/JSON-Geometry-format-4. I think it should be up to date. You should be able to store your coordinates as vertices. If you want your own format, it's probably easier to write your own parser. Good luck

Upvotes: 1

Related Questions