I dont understand how nobody else has had this problem, I am running threejs server side for collision detection and I need it to load a obj/mtl file. However, it appears that the threejs base loader uses xmlhttprequest, which is not supported by nodejs. I tried installing the xmlhttprequest module but it seems to not pass anything to the loader, as when i log the callback function for onload’s event it is undefined. I am getting an error about parsing the json, because there is no json to parse.
Load your .obj locally into a string, and call the obj loaders parse method.
Also, you shouldn’t need the .mtl file for physics. But the mtl loader also has a parse method if you insist.
But I would like to have the same code be used client and server side, is this impossible?