Add "Hide on Contact" collision mode to ParticlesMaterial #61238
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This can be used to make particles disappear when colliding, rather than bouncing around or sticking to surfaces.
This is useful for rain particles which should not be able to go through floors/ceilings, but shouldn't stick to surfaces either.
Performance-wise, this will perform better than using Rigid since inactive particles are no longer rendered – their vertices are culled by the GPU, and the mesh materials won't use up any fillrate.
This implementation works with subemitters. You can use a "parent" particle that has collision mode set to Hide On Contact, and a subemitter with Rigid collision mode. If you use similar-looking particles, this can be used to simulate scaling or color changes on contact. This can also be used to create decal billboards on contact (using small plane meshes, not actual Decal nodes).
simplescreenrecorder-2022-05-21_00.10.39.mp4
This implementation currently doesn't handle trails correctly (they will create a "streak" back to the particle system origin), but I believe this is an engine bug.
Testing project: https://0x0.st/oajR.zip (link expires in April 2023)