Launching players

Discussion in 'Plugin Development' started by Rockslide, Nov 16, 2012.

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

    Rockslide

    player.setVelocity(player.getDirection().multiply(10f));

    This launches the player as expected, but it doesn't follow a parabolic path. It's like the player gets hit with a strong wind and decellerates very fast horizontally, but not vertically. After some 20 blocks he just falls straight down.

    How do I prevent this unrealistic 'air resistance'?
     
  2. you cant do this, because the movent of the client is caused by their game, and most people wont want that their users of the server need to instal an plugin (but you can set the velocity to what your want every tick, but this may cause problems whit lagging players)
     
  3. Offline

    wristdirect

    Not sure where player.getDirection() is coming from, I don't see that as part of the Bukkit API.

    Either way, something like this should work.
    Code:
    Vector velocity = player.getVelocity();
    velocity.setY(.5);
    player.setVelocity(velocity);
     
  4. Offline

    Rockslide

    It's player.getLocation().getDirection, sorry :)

    But you are missing the point. The launching works, the trajectory is just weird and abruptly stops.

    As a test I tried player.setVelocity(new Vector(0f, 1f, 1f).normalize().multiply(10f));
    This launches the player at a 45 degree angle towards Z. But it doesn't follow a smooth curve.

    I will try setting the velocity every tick as ferrybig suggested, but I was hoping there would be a more efficient way.
     
Thread Status:
Not open for further replies.

Share This Page