summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-04-25 16:03:28 +0200
committerGitHub <noreply@github.com>2022-04-25 16:03:28 +0200
commit30aeffd0c494fc440636f0699698cd67b8cd26ef (patch)
tree34794e82e0a4ee9bbad645ed7783b13bb67c9992
parentfbfecc1deaa23c253cb203d4e66e307fb67f6766 (diff)
parentf603c750352ecb384f4c74f067d926061498e699 (diff)
Merge pull request #60491 from RedHeadphone/master
Correct initial cpu particle velocity
-rw-r--r--scene/2d/cpu_particles_2d.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp
index bad1488d5a..24c66622f1 100644
--- a/scene/2d/cpu_particles_2d.cpp
+++ b/scene/2d/cpu_particles_2d.cpp
@@ -743,7 +743,7 @@ void CPUParticles2D::_particles_process(double p_delta) {
real_t angle1_rad = direction.angle() + Math::deg2rad((Math::randf() * 2.0 - 1.0) * spread);
Vector2 rot = Vector2(Math::cos(angle1_rad), Math::sin(angle1_rad));
- p.velocity = rot * Math::lerp(parameters_min[PARAM_INITIAL_LINEAR_VELOCITY], parameters_min[PARAM_INITIAL_LINEAR_VELOCITY], (real_t)Math::randf());
+ p.velocity = rot * Math::lerp(parameters_min[PARAM_INITIAL_LINEAR_VELOCITY], parameters_max[PARAM_INITIAL_LINEAR_VELOCITY], (real_t)Math::randf());
real_t base_angle = tex_angle * Math::lerp(parameters_min[PARAM_ANGLE], parameters_max[PARAM_ANGLE], p.angle_rand);
p.rotation = Math::deg2rad(base_angle);