diff options
author | QbieShay <cislaghi.ilaria@gmail.com> | 2023-11-21 21:01:26 +0100 |
---|---|---|
committer | QbieShay <cislaghi.ilaria@gmail.com> | 2023-11-23 11:46:07 +0100 |
commit | 4d390cd39df514c77d9000b4195d7773a4e0fad4 (patch) | |
tree | 4805824310f0ed9ecd4d35aa865040f36144e8c9 /scene/resources/particle_process_material.cpp | |
parent | 80de898d721f952dac0b102d48bb73d6b02ee1e8 (diff) | |
download | redot-engine-4d390cd39df514c77d9000b4195d7773a4e0fad4.tar.gz |
Subemitter emission at end now correctly emits at end
Diffstat (limited to 'scene/resources/particle_process_material.cpp')
-rw-r--r-- | scene/resources/particle_process_material.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scene/resources/particle_process_material.cpp b/scene/resources/particle_process_material.cpp index 2a70deee6c..f75a899d3b 100644 --- a/scene/resources/particle_process_material.cpp +++ b/scene/resources/particle_process_material.cpp @@ -1125,9 +1125,9 @@ void ParticleProcessMaterial::_update_shader() { code += " if (COLLIDED) emit_count = sub_emitter_amount_at_collision;\n"; } break; case SUB_EMITTER_AT_END: { - code += " float unit_delta = DELTA/LIFETIME;\n"; - code += " float end_time = CUSTOM.w * 0.95;\n"; // if we do at the end we might miss it, as it can just get deactivated by emitter - code += " if (CUSTOM.y < end_time && (CUSTOM.y + unit_delta) >= end_time) emit_count = sub_emitter_amount_at_end;\n"; + code += " if ((CUSTOM.y / CUSTOM.w * LIFETIME) > (LIFETIME - DELTA)) {\n"; + code += " emit_count = sub_emitter_amount_at_end;\n"; + code += " }\n"; } break; default: { } |