Skip to content

Commit 8fe044e

Browse files
authored
added fix for piling oscillations
untested, need to verify it works
1 parent f1ffbe0 commit 8fe044e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

wled00/FXparticleSystem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ void handleCollision(PSparticle *particle1, PSparticle *particle2, const uint8_t
820820
{
821821
if (dx < 2 * PS_P_HARDRADIUS && dx > -2 * PS_P_HARDRADIUS)
822822
{ // distance is too small
823-
push = 1;
823+
push = 1+random8(3); //make push distance a little random to avoid oscillations
824824
if (dx < 0) // dx is negative
825825
{
826826
push = -push; // invert push direction
@@ -830,7 +830,7 @@ void handleCollision(PSparticle *particle1, PSparticle *particle2, const uint8_t
830830
}
831831
if (dy < 2 * PS_P_HARDRADIUS && dy > -2 * PS_P_HARDRADIUS)
832832
{ // distance is too small (or negative)
833-
push = 1;
833+
push = 1+random8(3);
834834
if (dy < 0) // dy is negative
835835
{
836836
push = -push; // invert push direction

0 commit comments

Comments
 (0)