Jump to content

Solid Particle System addShape after creation


mjmfighter
 Share

Recommended Posts

Is it possible to call addShape on a Solid Particle System after creation?  

For example, I am using the following playground example: https://www.babylonjs-playground.com/#2BXZC#2  I am modifying it so only one shape is spawned in the beginning and whenever that particle touches the ground I want it to spawn a new one (as well as reset the old one).  I have tried adding a addShape call within the "recycle if touched the ground" if statement, but it errors out every time.

Link to comment
Share on other sites

For now, you can't add shapes nor particles once the call to .buildMesh().

You have to fill your SPS with all the expected shapes and particles, then disable or hide (alive = false or isVisible = false) the unneeded ones until you need them back. This way is quite performant because dead or invisible particles aren't processed.

I intend to add the ability to extend the SPS one created in a decent delay (currently working on a prototype of SPS with concurrency using workers and sharedArrayBuffers to check if it's worth it, what requires a deep refactor to replace arrays of objects by arrays of floats only)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...