Cylindrecial Particle Shape

Discussion in 'Plugin Development' started by HeavyMine13, Jan 24, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    HeavyMine13

    Yo! So I was trying to make a cylinder of particles, and took some code from @Slikey EffectLib, and changed it to be a method(it was a class). Problem is, it displays a weird FILLED disc above me and that is it. Any ideas how can I fix it :p? Thanks!

    Code:
        public void Cylin(final Player p) {
            Location loca = p.getLocation();
            Location location = new Location(loca.getWorld(), loca.getX(), loca.getY() + 1.5, loca.getZ());
            Random r = RandomUtils.random;
            for (int i = 0; i < 150; i++) {
                Vector v = RandomUtils.getRandomCircleVector().multiply(1);
                if (r.nextFloat() <= sideRatio) {
                    // SIDE PARTICLE
                    v.multiply(1);
                    v.setY((r.nextFloat() * 2 - 1) * (2 / 2));
                } else {
                    // GROUND PARTICLE
                    v.multiply(r.nextFloat());
                    if (r.nextFloat() < 0.5) {
                        // TOP
                        v.setY(1 * (2 / 2));
                    } else {
                        // BOTTOM
                        v.setY(-1 * (2 / 2));
                    }
                }
                ParticleEffect.FLAME.display(0, 0, 0, 0, 1, location.add(v), 16);
                location.subtract(v);
            }
        }
    
    PS: @ChipDev @LCastr0 Can you guys have a look please, I know ur insane with such stuff

    Thanks again <3

    Edit 1: Slikey's Code: https://github.com/Slikey/EffectLib...e/slikey/effectlib/effect/CylinderEffect.java
     
    Last edited: Jan 25, 2016
  2. Offline

    Zombie_Striker

  3. Offline

    ChipDev

    Ill test your code out and make some edits! :D
    EDIT: What imports?
     
    HeavyMine13 likes this.
  4. Offline

    ShowbizLocket61

    @HeavyMine13
    At first glance, it would seem like this is happening because you're not doing anything to the location where you're spawning this disc. It would become a cylinder if you steadily increased the y. However, I'm not too sure, because I have no clue what these SIDE, GROUND, BOTTOM, and TOP particles are.

    Also, why are you using a random generator? It would be better if you could use loops or schedulers that give you what you want, every time, systematically.
     
  5. Offline

    HeavyMine13

  6. Offline

    mythbusterma

    @HeavyMine13

    I would honestly write the code to do this yourself, and all you have to do is set the X and Z to the cosine and sine functions of a loop value that goes around a circle, then slowly increment Y to go up.
     
  7. Offline

    HeavyMine13

    Will try my best. I hope it will work. Thanks. Will keep this posted
     
Thread Status:
Not open for further replies.

Share This Page