Launching Player

Discussion in 'Plugin Development' started by ShredNyx, Dec 30, 2013.

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

    ShredNyx

    Whats the statement to launch a player using con and sin launch them backwards high up in the air
     
  2. Offline

    NathanWolf

    You want to use setVelocity. If you want to launch them backwards, you could start with the player's direction vector and modify it to get the effect you want (e.g. Invert it, set y component, multiply by desired speed, etc)
     
  3. Offline

    ShredNyx

  4. Offline

    Pezah

    This is to 'leap' a player forward into the air, not sure how you'd do it backwards but this may help;
    Code:java
    1. Vector velocity = p.getLocation().getDirection();
    2. velocity.add(new Vector(0, 0.4, 0));
    3. p.setVelocity(velocity);
     
  5. Offline

    NathanWolf

    Something like

    Code:
    Vector velocity = player.getLocation().getDirection();
    velocity.multiply(-1).setY(1);
    player.setVelocity(velocity);
    
    You'll have to play with it and experiment to get the effect you want, but that ought to be the general idea.
     
Thread Status:
Not open for further replies.

Share This Page