Join 2 Locations With a Particle Line

Discussion in 'Plugin Development' started by danichef, Feb 16, 2018.

Thread Status:
Not open for further replies.
  1. Hello everyone!
    I'm trying to join 2 locations with a particle line, but I'm stuck and I've got no idea how to continue, I've already tried some tutorials, but for most of them you need another API. Heres what I've done up to now:
    Code:
        public void path(String[] args, Player player) {
    
            World w1 = Bukkit.getServer().getWorld(settings.getData().getString("loc." + args[0] + ".world"));
            double x1 = settings.getData().getDouble("loc." + args[0] + ".x");
            double y1 = settings.getData().getDouble("loc." + args[0] + ".y");
            double z1 = settings.getData().getDouble("loc." + args[0] + ".z");
           
            World w2 = Bukkit.getServer().getWorld(settings.getData().getString("loc." + args[0] + ".world"));
            double x2 = settings.getData().getDouble("loc." + args[1] + ".x");
            double y2 = settings.getData().getDouble("loc." + args[1] + ".y");
            double z2 = settings.getData().getDouble("loc." + args[1] + ".z");
           
            Location start = (new Location(w1, x1, y1, z1));
            Location end = (new Location(w2, x2, y2, z2));
    
            Vector vec = end.subtract(start).toVector();
                      
    
    
        }
    
    Thanks for your time :D
     
  2. Offline

    timtower Administrator Administrator Moderator

    @danichef Step by step instructions:
    1. Copy the vector
    2. Divide the copy by the amount of distance you want between the particles. This is the amount of times you need to loop.
    3. Loop for ...
    4. In each step: Take start, add vec / totalsteps, you should get a location out of it.
    5. Put a particle there.
     
Thread Status:
Not open for further replies.

Share This Page