Solved Launching an entity (Vector help)

Discussion in 'Plugin Development' started by Exloki, May 8, 2013.

Thread Status:
Not open for further replies.
  1. Hello!

    Basically, I'm trying to create an item at Player "p" location, and I want to launch the item in the direction the player is facing, as if they're throwing the item. I know how to spawn the item, get the direction etc, I'm just unsure of how to use the vectors to give the item a velocity in the direction the player is facing.

    Any help would be greatly appreciated, thanks!
     
  2. Offline

    Craftiii4

  3. I still don't understand, sorry. ;s I just want to be able to set velocity in a direction.

    Solved:
    Entity e;
    Player p;
    double speed;
    e.setVelocity(p.getLocation().getDirection().multiply(speed));

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

Share This Page