Script de partículas

Crea una esfera de partículas alrededor de una entidad. Versión Npcs.
 avatar
unknown
javascript
2 years ago
707 B
16
Indexable
// Versión Npcs
// EFECTOS: https://mcreator.net/wiki/particles-ids
particleSphere(world.getTempData("API").getPlayer(player.getName()).getLocation(), 2, 50, "flame");

function particleSphere(location, radius, particles, particle) {
    var phi = Math.PI * (3 - Math.sqrt(5));
    
    for (var i = 0; i < particles; i++) {
        var y = 1 - (i / (particles - 1)) * 2;
        var radius2 = Math.sqrt(1 - y * y) * radius;
        var theta = i * phi;
        var x = Math.cos(theta) * radius2;
        var z = Math.sin(theta) * radius2;
      
        world.spawnParticle(particle, location.getX() + x, location.getY() + (y * (radius * 2)), location.getZ() + z, 0, 0, 0, 0, 25);
    } 
}