godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.48k stars 21.08k forks source link

GPUParticles lifetime is uncertain when oneshot is true and explosiveness is 1 #81692

Open younggam opened 1 year ago

younggam commented 1 year ago

Godot version

v4.1.1.stable.official [bd6af8e0e]

System information

Godot v4.1.1.stable - Windows 10.0.19045 - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 2060 SUPER (NVIDIA; 31.0.15.3713) - Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz (6 Threads)

Issue description

제목없음25

As initial velocity is 100, accel is 10, lifetime is 10, particles should be killed when they stop. But you can see that doesn't. Lifetime got x2.x times longer

I found that builtin ParticleProcessMaterial works well because it automatically deactivates its particles after lifetime. If this is intended, we need node or properties that can easily handle activation.

Steps to reproduce

  1. Create your own shader resource as particle mode.
  2. Set oneshot true and explosiveness 1 at GPUParticles
  3. Enable emitting
  4. You can see that particles live longer than lifetime.

Minimal reproduction project

v.zip

clayjohn commented 11 months ago

The lifetime for all particles is 2 * lifetime. This is because for a regular particle system the last particle is emitted at lifetime and can live for a lifetime. When you write your own particle shader, you need to manage your particle lifetimes if you want to ensure that each individual particle is killed once it reaches lifetime

zhagsenkk commented 11 months ago

I have the same issue. When setting oneshot true and explosiveness 1, the emitting finished signal is emitted when all particals dies. But in the callback function, there is nothing happen when i set emitting true.