Solved Kangaroo kit vector problem?

Discussion in 'Plugin Development' started by lordbobby104, Jan 1, 2014.

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

    lordbobby104

    I am trying to create a kangaroo kit for my kit server. The problem is that I can't seem to set the velocity right. I want it so that the player is only launched on there X and Z and not on the Y. This is what I tried from my hour of googling:
    Code:
                Player p = e.getPlayer();
                if(!(kk.contains(e.getPlayer()))) {
                    p.setFallDistance(-5.0F);
                    Vector vector = p.getEyeLocation().getDirection();
                    vector.multiply(0.6F);
                    vector.setY(1.0F);
                    p.setVelocity(vector);
                    kk.add(e.getPlayer());
                   
                    final Player player = e.getPlayer();
                    Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin, new Runnable() {
                        public void run() {
                            kk.remove(player);
                        }
                    }, 20 * 2);
                }
    I'm not good at velocities so any help what so ever is appreciated

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
  2. Offline

    Ronbo

    lordbobby104
    vector.setY(0);
    You set it to 1, which makes the velocity have an upward component of 1 block.
     
  3. Offline

    lordbobby104

    Ronbo Thank you! I totally forgot I had that in there!
     
Thread Status:
Not open for further replies.

Share This Page