Using SPS immutable, stuck with the model mesh with the returned mesh

I built a SPS that is updatable and everything was fine. The resulting mesh included only my particles.

I then updated the code to make it immutable since I’m only moving the mesh and not the particles. So I did a pretty standard SPS build as below but now I’m stuck with the model mesh (theBox) included in the returned mesh from SPS.BuildMesh(). It’s easy to see since it’s sitting at coordinates 0,0,0 and white. When I move the returned mesh, check its bounding info or dispose of it, it’s quite clear that the model mesh is part of the returned mesh.

How can I get rid of that model mesh from the returned SPS.BuildMesh result?

// build the SPS
const SPS = new bjs.SolidParticleSystem(‘SPS’, scene, {updatable : false});
const theBox = bjs.MeshBuilder.CreateBox(“box”, { height: 1, width: 1, depth: 1 }, scene);
SPS.addShape(theBox, x, {positionFunction: myBuilder});
const RowMesh = SPS.buildMesh(); // <- this return a mesh with my particles but also the model mesh

// builder function
const myBuilder = (particle: { color: bjs.Color4; position: { x: number; y: number; z: number }; scaling: bjs.Vector3; isVisible: boolean }, i: string | number, s: any) => {
particle.color = color;
particle.position.x = 50.5;
particle.position.y = intY;
particle.position.z = intZ;
particle.scaling = new bjs.Vector3(1, intHeight, 1);

Pinging @jerome

Could you please provide a repro PG ?
Actually the model mesh is just copied (as the geometry level) to build the SPS. It’s not a part of the final SPS.

All right. I got it.

Those ghost particles were actually my own particles and not the model.
I was setting those particles to isVisible = false since they’re not required. And not setting position/color on them. So they ended up white at 0,0,0 on top of each other.

Reading this post (Solid Particle System particle.alive question - Questions & Answers - HTML5 Game Devs Forum), I now understand that isVisible/alive properties are Boolean for my own use and not doing anything as I was expecting.

I would suggest updating the documentation here (Managing Solid Particles | Babylon.js Documentation) to give a clue about this behaviour. A naïve person (like me) would assume it is possible to turn them off using the “isVisible” or the “alive” property.

I’ll use the opportunity to thank every contributors to this awesome library. I’ve been digging the forums and learning Babylon.js for the last three months and I’m having a blast. The response speed and the involvement of folks I’ve seen in this forum is amazing. Thanks Evgeni_Popov for pinging the right guy and thanks jerome for this SPS system and trying to help.