summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-06-12 10:53:31 +0200
committerGitHub <noreply@github.com>2019-06-12 10:53:31 +0200
commitfd66a45f3253add2699a5036f513b17d3546bd40 (patch)
tree5c5c1a03e01beb512254dd82848341dfbe89a698 /scene/3d
parenta4583657802b923e48009bb01a2c7ac5d7e6f186 (diff)
parent9206bcabaa115ad38c917521d9c1aabd25f4ec6b (diff)
Merge pull request #29685 from akien-mga/cpuparticles-tangential-accel
CPUParticles: Fix inconsistent tangential acceleration
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/cpu_particles.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp
index 138c446fea..1f2cb9a2bc 100644
--- a/scene/3d/cpu_particles.cpp
+++ b/scene/3d/cpu_particles.cpp
@@ -754,8 +754,9 @@ void CPUParticles::_particles_process(float p_delta) {
//apply tangential acceleration;
if (flags[FLAG_DISABLE_Z]) {
- Vector3 yx = Vector3(diff.y, 0, diff.x);
- force += yx.length() > 0.0 ? (yx * Vector3(-1.0, 0, 1.0)) * ((parameters[PARAM_TANGENTIAL_ACCEL] + tex_tangential_accel) * Math::lerp(1.0f, rand_from_seed(alt_seed), randomness[PARAM_TANGENTIAL_ACCEL])) : Vector3();
+ Vector2 yx = Vector2(diff.y, diff.x);
+ Vector2 yx2 = (yx * Vector2(-1.0, 1.0)).normalized();
+ force += yx.length() > 0.0 ? Vector3(yx2.x, yx2.y, 0.0) * ((parameters[PARAM_TANGENTIAL_ACCEL] + tex_tangential_accel) * Math::lerp(1.0f, rand_from_seed(alt_seed), randomness[PARAM_TANGENTIAL_ACCEL])) : Vector3();
} else {
Vector3 crossDiff = diff.normalized().cross(gravity.normalized());