From fae3df1204df6d4a64f48b4ae931d52897e4996c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 21 Jun 2019 15:23:10 +0200 Subject: [PATCH 1/2] Particles: Properly initialize angular velocity parameter Right now it would take garbage values when loading scenes, which could end up written to the scene file. --- scene/2d/cpu_particles_2d.cpp | 2 +- scene/3d/cpu_particles.cpp | 1 + scene/resources/particles_material.cpp | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp index a8d72bb7740..a9071819e55 100644 --- a/scene/2d/cpu_particles_2d.cpp +++ b/scene/2d/cpu_particles_2d.cpp @@ -1392,9 +1392,9 @@ CPUParticles2D::CPUParticles2D() { set_spread(45); set_flatness(0); set_param(PARAM_INITIAL_LINEAR_VELOCITY, 1); + set_param(PARAM_ANGULAR_VELOCITY, 0); set_param(PARAM_ORBIT_VELOCITY, 0); set_param(PARAM_LINEAR_ACCEL, 0); - set_param(PARAM_ANGULAR_VELOCITY, 0); set_param(PARAM_RADIAL_ACCEL, 0); set_param(PARAM_TANGENTIAL_ACCEL, 0); set_param(PARAM_DAMPING, 0); diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp index cff147ba74a..e325e6a1243 100644 --- a/scene/3d/cpu_particles.cpp +++ b/scene/3d/cpu_particles.cpp @@ -1460,6 +1460,7 @@ CPUParticles::CPUParticles() { set_spread(45); set_flatness(0); set_param(PARAM_INITIAL_LINEAR_VELOCITY, 1); + set_param(PARAM_ANGULAR_VELOCITY, 0); set_param(PARAM_ORBIT_VELOCITY, 0); set_param(PARAM_LINEAR_ACCEL, 0); set_param(PARAM_RADIAL_ACCEL, 0); diff --git a/scene/resources/particles_material.cpp b/scene/resources/particles_material.cpp index 758475b75e1..a80a57a09ce 100644 --- a/scene/resources/particles_material.cpp +++ b/scene/resources/particles_material.cpp @@ -1202,6 +1202,7 @@ ParticlesMaterial::ParticlesMaterial() : set_spread(45); set_flatness(0); set_param(PARAM_INITIAL_LINEAR_VELOCITY, 0); + set_param(PARAM_ANGULAR_VELOCITY, 0); set_param(PARAM_ORBIT_VELOCITY, 0); set_param(PARAM_LINEAR_ACCEL, 0); set_param(PARAM_RADIAL_ACCEL, 0); From b3fe249e946a85ca64f344d2dd7de6f07666bfe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 21 Jun 2019 15:23:48 +0200 Subject: [PATCH 2/2] CPUParticles: Set linear velocity to 0, like GPU Particles --- scene/2d/cpu_particles_2d.cpp | 2 +- scene/3d/cpu_particles.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp index a9071819e55..2396faa84bc 100644 --- a/scene/2d/cpu_particles_2d.cpp +++ b/scene/2d/cpu_particles_2d.cpp @@ -1391,7 +1391,7 @@ CPUParticles2D::CPUParticles2D() { set_spread(45); set_flatness(0); - set_param(PARAM_INITIAL_LINEAR_VELOCITY, 1); + set_param(PARAM_INITIAL_LINEAR_VELOCITY, 0); set_param(PARAM_ANGULAR_VELOCITY, 0); set_param(PARAM_ORBIT_VELOCITY, 0); set_param(PARAM_LINEAR_ACCEL, 0); diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp index e325e6a1243..6dc1b935769 100644 --- a/scene/3d/cpu_particles.cpp +++ b/scene/3d/cpu_particles.cpp @@ -1459,7 +1459,7 @@ CPUParticles::CPUParticles() { set_spread(45); set_flatness(0); - set_param(PARAM_INITIAL_LINEAR_VELOCITY, 1); + set_param(PARAM_INITIAL_LINEAR_VELOCITY, 0); set_param(PARAM_ANGULAR_VELOCITY, 0); set_param(PARAM_ORBIT_VELOCITY, 0); set_param(PARAM_LINEAR_ACCEL, 0);