Looping Through Locations

Discussion in 'Plugin Development' started by Jakeob22, May 25, 2014.

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


    I'm trying to create particle effects in the straight line that a player is looking in up to 7 blocks away. I used this code:

    3. public void createParticles(Player player){
    4. Vector direction = player.getEyeLocation().getDirection();
    5. double angle = direction.angle(new Vector(0,0,1));
    6. double x = Math.sin(angle);
    7. double z = Math.cos(angle);
    9. for(int i=1;i<=7;i++){
    10. Location loc = player.getLocation().add(x * i, 0, z * i);
    11. ParticleEffect.LARGE_SMOKE.display(loc, 15, 0, 0, 0, 10, 3);
    12. }
    13. }

    I am using THIS for my particle effects. For some reason, the particles seem to be spewing out in all directions from the player's location when I run through this. Is there anything you can see that I'm doing wrong? Thank you!
  2. Offline


    Hmm idk the solution but change your title to looping no cycling
Thread Status:
Not open for further replies.

Share This Page