Loading multiple models with a for loop?

Hello!

I’m trying to load 15 different 3D models in P5 and make them appear at specific time.
Is there a way to load models with a “for loop” and place the models in an array? I’m a complete beginner :confused:

Here’s what I’m trying to do:

let woman_frames = [];

function preload() {
for (let i = 1; i < 15; i++) {
  woman_frames[i] = 
    
  loadModel('woman_frames/'woman_framei[i].obj')
}
}

Thanks

please format code with </> button * homework policy * asking questions

  loadModel('woman_frames'+i+'.obj')

this should work when your file names are

woman_frames0.obj
woman_frames1.obj

etc.

by the way, arrays usually start with 0 not with 1

Hey, and welcome to the forum!

Great to have you here!

Warm regards,

Chrisir

Thank you so much! :slight_smile:
It worked perfectly!

warm regards to you too!