How would I launch someone in the airI ?

Discussion in 'Plugin Development' started by born2kill_, Aug 10, 2014.

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

    born2kill_

    I'm not that good with Vectors, s can someone tell me how to launch someone in the air about 25 blocks. I have code (that I don't have access to right now) that only works sometimes, and I want it to work all the time.
     
  2. Offline

    Giraffeknee

    I'm not sure what the exact vector for 25 blocks would be but doing player.setVelocity(new Vector(0, 4, 0)) should launch them fairly high. born2kill_

    born2kill_
    Okay I believe this would be 25 blocks.

    Vector from = new Vector(player.getX(), player.getY(), player.getZ());
    Vector to = new Vector(player.getX(), player.getY() + 25, player.getZ());
    Vector vec = to.subtract(from);
    player.setVelocity(vec);

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
Thread Status:
Not open for further replies.

Share This Page