Skip to content

Commit

Permalink
added fix for piling oscillations
Browse files Browse the repository at this point in the history
untested, need to verify it works
  • Loading branch information
DedeHai committed Feb 10, 2024
1 parent f1ffbe0 commit 8fe044e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wled00/FXparticleSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ void handleCollision(PSparticle *particle1, PSparticle *particle2, const uint8_t
{
if (dx < 2 * PS_P_HARDRADIUS && dx > -2 * PS_P_HARDRADIUS)
{ // distance is too small
push = 1;
push = 1+random8(3); //make push distance a little random to avoid oscillations
if (dx < 0) // dx is negative
{
push = -push; // invert push direction
Expand All @@ -830,7 +830,7 @@ void handleCollision(PSparticle *particle1, PSparticle *particle2, const uint8_t
}
if (dy < 2 * PS_P_HARDRADIUS && dy > -2 * PS_P_HARDRADIUS)
{ // distance is too small (or negative)
push = 1;
push = 1+random8(3);
if (dy < 0) // dy is negative
{
push = -push; // invert push direction
Expand Down

0 comments on commit 8fe044e

Please sign in to comment.