godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.12k stars 69 forks source link

Make CPUParticles3D emit a signal with the particle position when a particle finishes its lifetime #3349

Open jcostello opened 2 years ago

jcostello commented 2 years ago

Describe the project you are working on

Testing 4.0

Describe the problem or limitation you are having in your project

Working on a meteor shower example where a meteor is a particle, there is no way to spawn nodes like a decal where a particle died.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

The particle node would emit a signal for each particle that died with the particle position.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Read above

If this enhancement will not be used often, can it be worked around with a few lines of script?

No

Is there a reason why this should be core and not an add-on in the asset library?

GPU Particles are core

Calinou commented 2 years ago

See also https://github.com/godotengine/godot-proposals/issues/3348.

There are a lot of potential questions with this:

But, most importantly…

jcostello commented 2 years ago

Communicating from the GPU back to the CPU is either very expensive or impossible. Therefore, this is likely only feasible for CPUParticles3D, not GPUParticles3D. For GPUParticles3D simulation to be efficient, everything needs to happen on the GPU – no exceptions.

@Calinou If this is imposible for GPU particles then maybe: 1) Allow the sub emit particles to rotate by the normal of the died particle. So water splash in the rain spawn with the right direction. 2) Implement decal particles

So both CPU or GPU can use it