Hi there
I’m a new user of p5js and loving learning what’s possible!
Can I get some advice please about the loadModel function?
I’m getting the error in console.log:
“ReferenceError: loadModel is not defined”
I can’t see where I’m going wrong, or how I’m deviating from the octahedron example at https://p5js.org/reference/#/p5/loadModel.
Only change is that I’ve downloaded a simple ships hull .obj file and using that instead.
Do I need an additional line in the index.html file for loadModel to be available? I.e., something along the lines of…
src=“libraries/p5.XXX???.js” type=“text/javascript”
if you just link to your https://editor.p5js.org/
project we not need to ask you for code of .js or .html
also there might be that
hull.obj is there / and in the correct path? suggest
“assets/hull.obj”
there might be also from inthere be called a other file AND that might be missing
“assets/?.mtl”
Oh yes, I agree with all your points.
The model is actually three hulls!
And yes, I’ll definitely use fill() and noStroke(), and also the /assets directory.
However, I’m wondering why it still doesn’t work locally on my laptop using sublimetext2. I downloaded the code that works as a zip file, but it is throwing an error in the console.log:
+++++
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///Users/cex/Documents/Processing/course%20-%20Heavy%20Lift/module%202/loadhull_test/working%20on%20p5js.org/3d-model.obj. (Reason: CORS request not http).
TypeError: NetworkError when attempting to fetch resource. 2 [p5.js:78248:25](file:///Users/cex/Documents/Processing/course%20-%20Heavy%20Lift/module%202/loadhull_test/working%20on%20p5js.org/p5.js)
+++++
-b- with the other editor you are on your own
a translate of the download to even
PDE / mode p5.js
is some work.
a direct run of of the download and unzip ( and double click index.html )
is also not working until you have some kind of server mode
( as file handling is involved / simple drawing are possible )
for chrome browser i use
-c- CORS and browser is a extra subject, search this forum
for firefox i use
# CORS Everywhere
Bypass CORS restrictions by altering http responses.
a - VERY nice kll, thanks! I like your navigation controls a lot, brilliant! And the fill() etc works great!
b - so do you generally just work online. One of the reasons I changed to local was to separate functions into different files on different tabs. Can you do this with editor.p5js.org?
why not, i would call it a extra project and
i would use it to have finished projects online available…
++ i use Raspberry Pi for it /
also you better have a main page with links to the p5.js …projects
but not for development
( there i use online editor or PDE / p5.js mode )