ReferenceError: loadModel is not defined

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
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
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
there might be also from inthere be called a other file AND that might be missing

Thanks kll! Good suggestion re, I wasn’t aware of this.
I am using sublimetext 2 but have copied my code here also:

1 Like

well, there is no
and i suggested you use a sub dir
you make first and then upload that obj file

also did you read that file?
does it need/load a ?.mtl file ( at the end )

Thank you kll!
It is working online now.

Using sublimetext2, I had the .obj file in the same directory as my index.html and sketch.js. Is there something else I need to do?

it looks like it works now,

  • why have that 3 same objects ? from the .obj?

  • why not used sub dir as i suggested

  • when use stroke see that mesh lines, is that how you constructed that model?

  • can use

setup() {

but actually see less.

  • better a operational 3D view
    instead that rotation thing…

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/ (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/

I feel I’m missing something basic!!!

-a- my operation version

-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

Also thanks for the web server for Chrome and Firefox tips!

I have node installed - would this be a route to getting a local server mode set up?

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 )

oh great! I have done some coding on RPi but not yet with Processing. I’ll keep that in mind!

Thanks for all your help!!

1 Like