1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 06:35:05 +08:00

Fix ParticleSpewer gravity calculation

This commit is contained in:
Opelkuh 2021-09-04 16:47:12 +02:00
parent 714cf33aac
commit 4c753420d3
2 changed files with 6 additions and 6 deletions

View File

@ -14,12 +14,12 @@ namespace osu.Game.Graphics.Particles
private const double particle_lifetime = 500; private const double particle_lifetime = 500;
private const float angular_velocity = 3f; private const float angular_velocity = 3f;
private const int angle_spread = 10; private const int angle_spread = 10;
private const float velocity_min = 1.3f; private const float velocity_min = 1300f;
private const float velocity_max = 1.5f; private const float velocity_max = 1500f;
private readonly int angle; private readonly int angle;
protected override float ParticleGravity => 0.25f; protected override float ParticleGravity => 750f;
public ParticleJet(Texture texture, int angle) public ParticleJet(Texture texture, int angle)
: base(texture, particles_per_second, particle_lifetime) : base(texture, particles_per_second, particle_lifetime)

View File

@ -28,7 +28,7 @@ namespace osu.Game.Graphics.Particles
public bool HasActiveParticles => Active || (lastParticleAdded + maxLifetime) > Time.Current; public bool HasActiveParticles => Active || (lastParticleAdded + maxLifetime) > Time.Current;
public override bool IsPresent => base.IsPresent && HasActiveParticles; 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) protected ParticleSpewer(Texture texture, int perSecond, double maxLifetime)
{ {
@ -182,9 +182,9 @@ namespace osu.Game.Graphics.Particles
public Vector2 PositionAtTime(float timeSinceStart, float gravity) public Vector2 PositionAtTime(float timeSinceStart, float gravity)
{ {
var progress = progressAtTime(timeSinceStart); 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); private float progressAtTime(float timeSinceStart) => Math.Clamp(timeSinceStart / Duration, 0, 1);