Files

788 B
Raw Permalink Blame History

radiation_explosion.js — ringParticles() (satır 205)

← radiation_explosion.js · ← Master

function ringParticles(world, cx, cy, cz, r)
{
    if (r < 1) return;
    var points = Math.min(80, 8 + r * 3);
    for (var i = 0; i < points; i++)
    {
        var u = Math.random() * 2 - 1;                 // -1..1
        var theta = Math.random() * Math.PI * 2;
        var sr = Math.sqrt(1 - u * u);
        var px = cx + 0.5 + r * sr * Math.cos(theta);
        var py = cy + 0.5 + r * u;
        var pz = cz + 0.5 + r * sr * Math.sin(theta);

        world.spawnParticles(PT_BLAST, true, px, py, pz, 1, 0, 0, 0, 0);
        world.spawnParticles(PT_SMOKE, true, px, py, pz, 2, 0.2, 0.2, 0.2, 0.01);
    }
}