Solved Launching a player in the opposite direction they're looking.

Discussion in 'Plugin Development' started by kampai, Jul 4, 2016.

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

    kampai

    I'm currently trying to do this when they right click a stick, but the problem is i dont know how to get the direction they're looking. I'm currently using vectors to do this.

    Would I use something like this?
    Code:
               Vector dir = player.getLocation().getDirection().normalize().getZ();
     
  2. Offline

    MCnumi

    My bad, please remove my comment, said something pretty stupid : P
     
  3. Offline

    Zombie_Striker

    @kampai
    Player.getLocation().getDirection()m returns the direction they are looking. You can use .toVector() to convert the direction to a vector.
     
  4. Offline

    ArsenArsen

    Take player.getLocation().getDirection() and store it. Multiply by - 1. Normalize. Set y to 0.5. Set player velocity to that.
     
    Last edited: Jul 4, 2016
  5. Offline

    ChipDev

    oh my. I had like a 100 line equation to do that one sentence about a year ago. Good job :eek:
     
    Last edited: Jul 5, 2016
  6. @ChipDev Good old ChipDev.

    @kampai If this thread has been solved please mark it so.
     
    ChipDev likes this.
Thread Status:
Not open for further replies.

Share This Page