Setting an arrows path/velocity

Discussion in 'Plugin Development' started by hockeyfreak77, Mar 3, 2013.

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

    hockeyfreak77

    I want to be able to shoot 4 arrows in different directions when I right click something. How would I set the velocity of an arrow to send it in a certain direction? I've looked on the forums and cam't find anything helpful.

    Thanks in advance!
     
  2. Offline

    frozenpoptartmc

    projectile.setVelocity(x, y, z);
     
  3. Offline

    minoneer

    First, you have to launch the arrows. (i.e. Arrow arrow1 = player.launchProjectile(Arrow.class);).

    Then you create a Vector representing the direction you want your arrow to fly to.
    Finally, you take the arrow and set it's velocity (arrow1.setVelocity(Vector)

    For some more information on calculating the destination, speed and vector, you might find this thread usefull:

    http://forums.bukkit.org/threads/precise-arrow-aiming-help-with-vectors.52280/
     
  4. Offline

    hockeyfreak77

    I've tried that, but an error comes up on the method setVelocity(). Says that .sestVelocity() cannot use the parameters (int, int, int)
     
Thread Status:
Not open for further replies.

Share This Page