Fireball shoots in horizontal angle

Discussion in 'Spigot Plugin Development' started by WiseHollow, Apr 8, 2016.

  1. Hi, I'm trying to spawn a fireball 20 blocks in the air and have it progress in a downward direction towards the ground. So far the fireball moves at an angle and I cannot get it to aim down. Can anyone give some advice? This is the code I've been working with so far...
    (First time using Vectors. Still learning.)

    Code (Text):

    Location src = new Location(target.getWorld(), target.getBlockX(), target.getBlockY(), target.getBlockZ());
    src.add(offsetX, 20, offsetZ);

    Fireball fb = src.getWorld().spawn(src, Fireball.class);
    Location dirLoc = src.clone().subtract(0, 20, 0).subtract(src);
    dirLoc.setPitch(90); //Aim down
    Location velLoc = src.clone().subtract(0, 1, 0);
    velLoc.setPitch(90); //Aim down
    Vector dir = dirLoc.toVector().normalize();
    Vector vel = velLoc.toVector().normalize();
    Any help is very appreciated. :)