fading particles
This commit is contained in:
parent
76fbe75242
commit
2c56f6fe52
1 changed files with 14 additions and 12 deletions
26
src/VFX.cs
26
src/VFX.cs
|
@ -23,7 +23,7 @@ static class VFX
|
||||||
index = (index + 1) % particles.Length;
|
index = (index + 1) % particles.Length;
|
||||||
Particle particle = particles[index];
|
Particle particle = particles[index];
|
||||||
particle.pos = pos;
|
particle.pos = pos;
|
||||||
particle.vel = Quat.FromAngles(Random.Shared.NextSingle() * 360, 0, 0) * Quat.FromAngles(0, Random.Shared.NextSingle() * 360, 0) * Vec3.Forward * 1.0f;
|
particle.vel = Quat.FromAngles(Random.Shared.NextSingle() * 360, 0, 0) * Quat.FromAngles(0, Random.Shared.NextSingle() * 360, 0) * Vec3.Forward * 6.0f;
|
||||||
particle.ori = Quat.Identity;
|
particle.ori = Quat.Identity;
|
||||||
particle.scl = (1.0f / 3) * Maths.smooth_start(Random.Shared.NextSingle());
|
particle.scl = (1.0f / 3) * Maths.smooth_start(Random.Shared.NextSingle());
|
||||||
}
|
}
|
||||||
|
@ -37,17 +37,19 @@ static class VFX
|
||||||
if (particle.vel.MagnitudeSq > float.Epsilon)
|
if (particle.vel.MagnitudeSq > float.Epsilon)
|
||||||
{
|
{
|
||||||
particle.pos += particle.vel * Time.Stepf;
|
particle.pos += particle.vel * Time.Stepf;
|
||||||
float scl_rad = particle.scl * 0.5f * 0.333f;
|
particle.vel *= 1 - (3 * Time.Stepf);
|
||||||
Vec3 next_pos = V.XYZ(
|
particle.scl *= 1 - (3 * Time.Stepf);
|
||||||
Maths.s_clamp(particle.pos.x, 2 - scl_rad),
|
// float scl_rad = particle.scl * 0.5f * 0.333f;
|
||||||
Maths.s_clamp(particle.pos.y, 2 - scl_rad),
|
// Vec3 next_pos = V.XYZ(
|
||||||
Maths.s_clamp(particle.pos.z, 2 - scl_rad)
|
// Maths.s_clamp(particle.pos.x, 2 - scl_rad),
|
||||||
);
|
// Maths.s_clamp(particle.pos.y, 2 - scl_rad),
|
||||||
if (next_pos.x != particle.pos.x || next_pos.y != particle.pos.y || next_pos.z != particle.pos.z)
|
// Maths.s_clamp(particle.pos.z, 2 - scl_rad)
|
||||||
{
|
// );
|
||||||
particle.pos = next_pos;
|
// if (next_pos.x != particle.pos.x || next_pos.y != particle.pos.y || next_pos.z != particle.pos.z)
|
||||||
particle.vel = Vec3.Zero;
|
// {
|
||||||
}
|
// particle.pos = next_pos;
|
||||||
|
// particle.vel = Vec3.Zero;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue