Particles not spawning in specified direction.

Discussion in 'Spigot Plugin Development' started by JavaNaza, Jun 27, 2018.

  1. Hello everybody, I m trying to spawn spiral particle but it doesn't work.
    1. It doesn't spawn in my looking directon.
    2. It doesn't even look like spiral just randomly flying particles.

    Here is my code:
    Code (Text):
       public void createHelix(Player player) {
            Location loc = player.getLocation();
            new BukkitRunnable() {
                double x = 0;
                int radius = 2;
                public void run() {
                    double y = radius * Math.cos(x);
                    double z = radius * Math.sin(x);

                    player.getWorld().spawnParticle(Particle.FLAME, new Location(player.getWorld(), loc.getX() + x, loc.getY() + y,
                            loc.getZ() + z, loc.getYaw(), loc.getPitch()), 1);
                    x += 0.5;
                    if (x == 50) {
            }.runTaskTimer(MainClass.plugin, 0, 1);
    Can somebody help me with that thank you and have a nice day.
  2. Just wanted to add the following. A lot of times, when using particles, you need stuff that that tutorial explains fine. But just because there may come a time where you have to know more about the subject, the name of the needed stuff is "Linear Algebra". It is all about algebra (calculations using functions) with stuff that is not a number: matrices, vectors, lines, directions...