New Mesh Creation Interval

Hello everyone,

I have a few questions about the PG below:
https://www.babylonjs-playground.com/#1TI7KR#3
(original post here).

  1. How would one start with a set number of spheres (instead of zero in the PG), then add spheres based on the interval? For instance, start with 10, then add 1 sphere every 200 ms until the max number is reached (100).

  2. To give meshes unique names, I would use the code below. However, I can’t seem to combine this code with the interval code in the PG so that all clones receive a unique name (“clone” + i). For example, the first 10 would be clone0, clone1,…, then each new clone would also have a unique name–clone101, clone102,…

         for (var i = 0; i < totalClones; i++) {
             let clone = sphereBase.clone("clone" + i);
         };  
    

Any help or suggestions would be greatly appreciated! :smiley: :+1:

Something like this?

https://www.babylonjs-playground.com/#1TI7KR#7

Hello again @PirateJC, and thanks for helping out with this! This is almost exactly right, but it seems that spheres are not being created when the total number falls below the max number. Here’s a PG where that number is set to 10.

https://www.babylonjs-playground.com/#1TI7KR#8

Spheres 0-9 appear first, and when one of those is removed, sphere 10 should appear and so on.

https://www.babylonjs-playground.com/#1TI7KR#10

(edit, just realized you were working on a rounded position)

How about this?

Thanks @kjg, that’s correct, I appreciate the help! Thanks again to @PirateJC also! This is the most helpful forum I’ve ever seen :smiley: :+1:

2 Likes