The module can be loaded well locally on my PC, but when I push it onto GithubPages, the module will not load, with no error in the console.
Repo link: GitHub - TiaTheFairy/rjxt at gh-pages
( JS File ./res/WaterPump.js , HTML: module.html )
Preview link(GithubPages): http://rjxt.mcfl.top
When visit locally:
When visit GithubPages
Maybe GitHub pages blocks the download since the OBJ file is almost 100 MB large. After a couple of reloads, I also get 429 Too Many Requests
errors.
BTW: 100 MB is no appropriate file size for the web. I suggest you switch to glTF, optimize the model and then try it again.
Hi, as the 3D team refuse to convert the file, I have to continue using OBJ.
I moved the file onto my own cloud server so it works now.
Now how I load the file is like this and it works properly.
var url = '.... my server ip + file path'
..... init things .....
OBJLoader.load(url, fun2);
I want to get some information from ajax so I changed it to this:
var addProgressForXhr = (fn) => {
var xhr = $.ajaxSettings.xhr()
if (typeof fn == "function") {
xhr.onprogress = fn;
}
return () => xhr
}
$.ajax({
url: '.... my server ip + file path',
xhr: addProgressForXhr(function (e) {
// I did something here
}),
success: function (result) {
..... init things .....
OBJLoader.load(result, fun2);
}
})
then it not works. I tried to console.log the result but it is the content in the file as a String. What should I do to make it possible to load the file in this way.
You probably have to add CORS headers to the HTTP response if you load the asset from a different domain than your application.