Sending a player backwards

Discussion in 'Plugin Development' started by Loogeh, Sep 30, 2012.

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

    Loogeh

    Hi, does anyone know how I could make a player get blown backwards slightly in the air and send the back about 5 - 10 blocks?
    I know how to do it for going forwards with player.setVelocity(player.getLocation().getDirection.multiply(double here));
    But, I can't figure out how to do it for the other way.
    Thanks
    - Loogeh
     
  2. Offline

    Borch

    Negative value?
     
  3. Offline

    Loogeh

    Didn't work.
     
  4. Offline

    skore87

    Multiply their vector by -1 for example and add 0.5 to the Y coord and that should get you about what you are looking for.

    so... multiply(-1).add(0,0.5,0)

    Just remember that multiplying their current vector by negative 1 just uses the same speed they were moving and makes them go the opposite. So if they aren't moving, they won't get pushed back.
     
  5. Offline

    Loogeh

    That worked, thank you :D
     
Thread Status:
Not open for further replies.

Share This Page