Spawn particles between entities.

Discussion in 'Plugin Development' started by q8minecraft, Apr 14, 2016.

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

    q8minecraft

    Hello.

    I have done many researches before posting this, but couldn't find a solution.

    I'm trying to spawn a line of particles between 2 (or more) entities. I just can not figure it out.

    That's what I currently have.

    Code:
        public void activateHealing(Location loc, Player p) {
            new BukkitRunnable() {
                double t = 0.017;
                double r = 3;
                double e = 0;
                public void run() {
                    e++;
                    Location loc = p.getLocation();
                    for(Entity allies : loc.getWorld().getNearbyEntities(loc, 7,7,7)){
                    double distance = loc.distanceSquared(allies.getLocation());
    }
                        if(e == 100){
                            this.cancel();
                        }
                }
            }.runTaskTimer(this, 0, 0);
        }
    I've know that you can spawn an arrow and spawn particles behind it. However, I prefer using it without arrows or any other projectile.
     
    Last edited: Apr 14, 2016
  2. Offline

    Lightspeed

    Quick question. . .
    Do you want it to spawn all the particles instantly or have a more smoother trail effect.
    How smooth is the effect: Spaces or a full nice think ish line?
     
  3. Offline

    q8minecraft

    @Lightspeed Spawning smoothly and having a nice curve (I believe I can do the curve myself if I got it working). That's what I have in mind :p
     
  4. Offline

    Zombie_Striker

    @q8minecraft
    1. Get the change in X over the change in Z.(Lets call this cX)
    2. Find in which direction the entity is relative to the other entity.
    3. Create a for loop. This will control the spacing between each entity. (lets call this int, I)
    4. Spawn a new particle at X = cX *I, and Z = 1*I.
     
  5. Offline

    q8minecraft

    Why does the 1 exactly refer to?
     
  6. Offline

    Zombie_Striker

    @q8minecraft
    1 represents the change in Z. Really, you could remove the 1 if you wanted, it just is there to show that for every time Z increases by 1, the X increases by cX.
     
  7. Offline

    q8minecraft

Thread Status:
Not open for further replies.

Share This Page