mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-15 15:09:29 +00:00
Use MaxSpeed when calculating speedGain (#921)
This calculation was never implemented from the Mercury Particle Engine port
This commit is contained in:
committed by
GitHub
parent
3314226861
commit
f56dc7b620
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace MonoGame.Extended.Particles.Modifiers
|
||||
@@ -20,11 +21,12 @@ namespace MonoGame.Extended.Particles.Modifiers
|
||||
|
||||
var distance2 = diff.LengthSquared();
|
||||
|
||||
var speedGain = _gravConst*Mass/distance2*elapsedSeconds;
|
||||
var speedGain = _gravConst*Mass/distance2;
|
||||
speedGain = Math.Max(Math.Min(speedGain, MaxSpeed), -MaxSpeed) * elapsedSeconds;
|
||||
// normalize distances and multiply by speedGain
|
||||
diff.Normalize();
|
||||
particle->Velocity += diff*speedGain;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user