Skip to content

Commit

Permalink
Subemitter emission at end now correctly emits at end
Browse files Browse the repository at this point in the history
  • Loading branch information
QbieShay committed Nov 23, 2023
1 parent 80de898 commit 4d390cd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scene/resources/particle_process_material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
}
Expand Down

0 comments on commit 4d390cd

Please sign in to comment.