Trying to create multiple particle beams

Discussion in 'Plugin Development' started by Awesom_AA, Aug 16, 2020.

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

    Awesom_AA

    Im trying to make it so my shot goes forward (like in the code), but also with a 30 degree turn both ways (so +/- 30 for the pitch). Somehow whenever I try to do something like loc.setYaw(loc.getYaw() + 30) it says that I can't convert from a void to a direction

    Code:
                                        double t = 0;
                                        Location loc = player.getLocation();
                                        Vector direction = loc.getDirection().normalize();
                                        // Location loc2 = player.getLocation().setPitch(30);
                                        // Vector direction2 = loc.setPitch(loc.getPitch()).getDirection().normalize();
                                        public void run(){
                                            t = t + 1;
    
                                            double x = direction.getX() * t;
                                            double y = direction.getY() * t + 1.5;
                                            double z = direction.getZ() * t;
                                            loc.add(x,y,z);
                                            player.getWorld().spawnParticle(Particle.REDSTONE, loc.getX(),loc.getY(),loc.getZ(), 1, 0, 0, 0);
                                            loc.subtract(x,y,z);
                                          
                                            /** double x2 = direction.getX() * t * Math.cos(30);
                                            double z2 = direction.getY() * t * Math.sin(30);
                                          
                                            loc.add(x2,y,z2);
                                            player.getWorld().spawnParticle(Particle.REDSTONE, loc.getX(),loc.getY(),loc.getZ(), 1, 0, 0, 0);
                                            loc.subtract(x2,y,z2); **/

    ^^ My code inside the bukkit runnable (works fine for the 1 beam) ^^

    Tl;dr: How to add 30 to the yaw in a location
     
    Last edited: Aug 16, 2020
Thread Status:
Not open for further replies.

Share This Page