Spawn an arrow with the normal velocity

Discussion in 'Spigot Plugin Development' started by Waterman2707, May 26, 2015.

  1. Hey

    I have now searched on google so much and can't find anything on how i can create/spawn a arrow so it will shoot like a normal arrow(when the bow is on the best(Don't know what you call it ;))).
    The best thing i have created yet is this
    Code (Text):
    p.shootArrow().setVelocity(p.getLocation().getDirection());
    And that is not that i want, actually i'm long from what i wont...
    I just need the standart velocity of a arrow, or it's okay if you can provide the code, but the standard velocity is all i need(i think :p) ;)

    //Water
     
  2. You can use the EntityShootBow event and check the standard speed yourself, you'll need to use a multiplier because there is n0t standard velocity (saying that velocity it's the vector), maybe you are talking about the speed.
     
  3. Yeah i have tried that, but also tried to use p.getLocation().getDirection() and should that two now been the same? i will need to calculate the velocity every time i shoot it, but i don't know how to calculate it...

    Edit: so i think i have asked the wrong question...
     
  4. Direction it's not the same as velocity. You need to know how fast do you want the arrow, the event was an option, after that just set the arrow you spawned its velocity multiplied per a number depending of how fast do you want the arrows to go.
     
    • Like Like x 1
  5. You are an amazing guy! Now i have got it to work ;)
     
    • Friendly Friendly x 1
  6. It's depricated but still works:
    Code (Text):
    player.shootArrow();
     
  7. Thanks because you try to help, but please read the thread and the replys. That method was I already using if you look in the thread, and I have solved my problem ;)