mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 13:22:55 +08:00
Fix ParticleSpewer
gravity calculation
This commit is contained in:
parent
714cf33aac
commit
4c753420d3
@ -14,12 +14,12 @@ namespace osu.Game.Graphics.Particles
|
||||
private const double particle_lifetime = 500;
|
||||
private const float angular_velocity = 3f;
|
||||
private const int angle_spread = 10;
|
||||
private const float velocity_min = 1.3f;
|
||||
private const float velocity_max = 1.5f;
|
||||
private const float velocity_min = 1300f;
|
||||
private const float velocity_max = 1500f;
|
||||
|
||||
private readonly int angle;
|
||||
|
||||
protected override float ParticleGravity => 0.25f;
|
||||
protected override float ParticleGravity => 750f;
|
||||
|
||||
public ParticleJet(Texture texture, int angle)
|
||||
: base(texture, particles_per_second, particle_lifetime)
|
||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Graphics.Particles
|
||||
public bool HasActiveParticles => Active || (lastParticleAdded + maxLifetime) > Time.Current;
|
||||
public override bool IsPresent => base.IsPresent && HasActiveParticles;
|
||||
|
||||
protected virtual float ParticleGravity => 0.5f;
|
||||
protected virtual float ParticleGravity => 0;
|
||||
|
||||
protected ParticleSpewer(Texture texture, int perSecond, double maxLifetime)
|
||||
{
|
||||
@ -182,9 +182,9 @@ namespace osu.Game.Graphics.Particles
|
||||
public Vector2 PositionAtTime(float timeSinceStart, float gravity)
|
||||
{
|
||||
var progress = progressAtTime(timeSinceStart);
|
||||
var grav = new Vector2(0, -gravity) * progress;
|
||||
var currentGravity = new Vector2(0, gravity * Duration / 1000 * progress);
|
||||
|
||||
return StartPosition + (Velocity - grav) * timeSinceStart;
|
||||
return StartPosition + (Velocity + currentGravity) * timeSinceStart / 1000;
|
||||
}
|
||||
|
||||
private float progressAtTime(float timeSinceStart) => Math.Clamp(timeSinceStart / Duration, 0, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user