How can I do something like a catapult

Discussion in 'Plugin Development' started by Julz_Dev, Sep 5, 2013.

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

    Julz_Dev

    Hello Community,

    I want to programm something like a catapult.

    I have y-coordinate, but the x & z coordinate is very difficult.

    Need help :

    p.setVelocity(p.getVelocity().setY(2.0D));

    I need to know how much z and x I must give.

    Thanks :)
     
  2. Offline

    OcelotcR

    try and error, set the z and x whatever and if you like it keep it, if not put other co-ords in
     
  3. Offline

    Julz_Dev

    But it's not the same...
    It is the line of sight.
    so it can be different every time
     
  4. Offline

    blablubbabc

    You can get a players view-direction vector via player.getLocation().getDirection();
     
  5. Offline

    Julz_Dev

    and what I have to then? :/
    I really don't know how to work with vectors.
     
  6. Offline

    Codex Arcanum

    Where exactly are you trying to catapult the player?
     
  7. Offline

    Julz_Dev

    Codex Arcanum
    I want the hubboost from hive.
    If you know this.
    It's not a catapult.
    I only want the boost
     
  8. Offline

    Codex Arcanum

    Nope, don't know that, never played on whatever server you're talking about. It kind of annoys me when people say "I can't explain what I'm trying to do, it's exactly what this other server does". I'm not coming down on you for unoriginality, but if you want help, you could start by explaining a little more about what you want.
     
  9. Offline

    Julz_Dev

    Codex Arcanum
    I am just trying to explain what I want -.-
    I want a boost in the air in the players direction.

    I did it alone :

    Code:
    player.setVelocity(player.getLocation().getDirection().multiply(3));
    player.setVelocity(new Vector(player.getVelocity().getX(), 1.0D, player.getVelocity().getZ()));
    Thanks anyway

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

Share This Page