diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-01-08 11:53:53 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-01-08 11:53:53 +0100 |
commit | 97607b6ab32aa608819005fc4be296755b749b16 (patch) | |
tree | 256d625ccc23b8bf662cd062f7d754cba059f323 /scene/3d/gpu_particles_3d.cpp | |
parent | 48b726deba12826a23fee958b942d93f34160f6c (diff) | |
parent | cb0a37f61aa772341e63e8ae8ee5bece211613f8 (diff) | |
download | redot-engine-97607b6ab32aa608819005fc4be296755b749b16.tar.gz |
Merge pull request #86474 from KoBeWi/particular_velocity
Only update particle velocity when it changes
Diffstat (limited to 'scene/3d/gpu_particles_3d.cpp')
-rw-r--r-- | scene/3d/gpu_particles_3d.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/scene/3d/gpu_particles_3d.cpp b/scene/3d/gpu_particles_3d.cpp index fc84b3308e..dfb039d709 100644 --- a/scene/3d/gpu_particles_3d.cpp +++ b/scene/3d/gpu_particles_3d.cpp @@ -460,7 +460,12 @@ void GPUParticles3D::_notification(int p_what) { // Use internal process when emitting and one_shot is on so that when // the shot ends the editor can properly update. case NOTIFICATION_INTERNAL_PROCESS: { - RS::get_singleton()->particles_set_emitter_velocity(particles, (get_global_position() - previous_position) / get_process_delta_time()); + const Vector3 velocity = (get_global_position() - previous_position) / get_process_delta_time(); + + if (velocity != previous_velocity) { + RS::get_singleton()->particles_set_emitter_velocity(particles, velocity); + previous_velocity = velocity; + } previous_position = get_global_position(); if (one_shot) { |