- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 23.5k
          Add amount_ratio to cpu particles to dynamically change amount emitted
          #105251
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…h `GPUParticles2D` and `GPUParticles3D` respectively
| This PR suppresses #70145 | 
| 
 Supersedes* 😅 | 
| I think the OP has meant to mention it instead of #79527 | 
| 
 Yeah, my bad 😅 | 
| That last change seems to simplify the code a lot. | 
| 
 I see, it's keeping inactive particles in their final state and the effects I was testing with had a scale/fade out so they seemed to be gone. I'll look into it. | 
| 
 Solved this in the latest commit. | 
| if (amount_ratio_accumulator >= 1.0) { | ||
| active_by_ratio = true; | ||
| amount_ratio_accumulator -= 1.0; | ||
| } else if (!p.active) { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same condition is few lines below.
| This needs testing to check how it behaves compared to GPUParticles. Code here: 
 GPUParticles set particles inactive at birth depending on a random value 
 This gives it an organic feel while still maintaining that zero has no emission and 1 is full emission. Your PR kills one particle every X, which is not the same behaviour. | 
| 
 See discussion in #104276. The "kill one particle every X" behavior seems more desirable overall, especially at low particle counts. That said, we should aim for consistency between CPUParticles and GPUParticles, so this PR should be changed to use the random approach for now. | 
Revival of #79527
This PR implements the
amount_ratiofield forCPUParticles2DandCPUParticles3D. This already landed forGPUParticles2DandGPUParticles3Dback in Godot v4.2 but the original PR for CPU particles never made it in.Changes from the original PR
amount_ratiowill no longer change theemittingflagamountandamount_ratioto match those forGPUParticles2DandGPUParticles3DFixes godotengine/godot-proposals#5939