summaryrefslogtreecommitdiffstats
path: root/scene/3d/gpu_particles_3d.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-01-08 11:53:53 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-01-08 11:53:53 +0100
commit97607b6ab32aa608819005fc4be296755b749b16 (patch)
tree256d625ccc23b8bf662cd062f7d754cba059f323 /scene/3d/gpu_particles_3d.cpp
parent48b726deba12826a23fee958b942d93f34160f6c (diff)
parentcb0a37f61aa772341e63e8ae8ee5bece211613f8 (diff)
downloadredot-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.cpp7
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) {