Solid Particle System updateParticle fails when attempting to pass a .props property into position

Relevant PG: https://playground.babylonjs.com/#XN1BZY#3
If you comment line 46, uncomment line 47, the particles update as expected.
However, lines 45 and 46 do not seem to work. Nothing seems to appear when I pass .props.theta in any form I’ve tried. No errors in the console that I can see.

I’m following the example here: https://playground.babylonjs.com/#GLZ1PX#7
Additionally, does the updateParticle function only use properties inside the individual particles? Ideally, I’d just pass some global time parameter into this update function.

EDIT aaaand of course I just solved it right after I posted this.

I just needed to remove the “new” keyword on line 34 :|. However, I still have the same question about property use for the updateParticle function.

UpdateParticle is indeed only passed an individual particle at a time, but you can use global variables on it: Babylon.js Playground (babylonjs.com)

1 Like

Thanks for that guidance! This is good to know. This makes SPS a fairly powerful solution, assuming that the camera can keep the mesh’s origin in view :+1:

You can set the SPS mesh to alwaysSelectActiveMesh = true so that it doesn’t clip out when the origin is not on view of the camera :smiley: Babylon.js Playground (babylonjs.com)

1 Like

Oh excellent! Thanks for this.

A follow-up question: Any idea why the orbs darken when the camera points up towards them?

Does it have to do with directional light + billboard mode and the fact that the particle quads are pointing “down” at the camera? I’m guessing that it has to be an emissive texture to counteract for that. Though it seems that any emissive texture “level” I try still allows for dimming to occur :thinking:

I don’t think particles are affected by lights, is that correct @sebavan ?

Yup totally correct, you would need SPS in case you want them to be lit.

That’s the thing. This is an SPS :smiley:

Awwww sorry I didn’t read that part in the code :rofl: Oh yeah if it’s an SPS it’s going to be affected by lights by default buuut you can also set disableLighting on the material: Babylon.js Playground (babylonjs.com)

1 Like

Ohh, I didn’t know about that option! Thanks :smiley: That’ll be quite useful for some other effects I’m looking to do.

1 Like