player.setVelocity goes strange distances

Discussion in 'Plugin Development' started by ZephireNZ, Jun 30, 2013.

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

    ZephireNZ

    I've got a function that works out the Vector for a player to go if they want to go from one Location to another. This function is outputting the same vector each time, however when I use this in player.setVelocity(), it can sometimes go twice as far as normal.

    For example, on one occassion it went an extra 15 blocks further than most of the other tests. What's more odd is that it seems to only be for players, I changed the setVelocity to an arrow, and it never deviated, even after many, many attempts.

    Is there a way to fix this, or is it a known issue?

    On further testing, it may be the y component that's doing it. when doing only a y change in the velocity, it will sometimes go quite high, or quite low.

    Nobody? It's strange behaviour, really want to get it ironed out :L

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 2, 2016
  2. Offline

    Gamecube762

    Its not really a strange behavior. Every time you do player.setVelocity(); it basically pushes the player with the force(vector) that you put in it, since the player already has some velocity on them, the Velocity that you set adds up with the Velocity that they already have. There isn't a way to predict where they would land since there is allways other stuff increasing or decreasing the player's velocity.
     
Thread Status:
Not open for further replies.

Share This Page