Move to a location

Discussion in 'Plugin Development' started by TechGuard, Apr 25, 2011.

Thread Status:
Not open for further replies.
  1. Is there an easy way to move a player to a location with velocity?
    Code:
    Vector vector = //The location were we want to go
    setVelocity(vector); //Move that player to that location
    We all know that doesn't work, but if someone understand what I mean. How can I do this?

    Pleas no posts with teleportTo() :p
     
  2. Offline

    Sammy

    Well there isn't... the problem is that when you setVelocity you only give the server/client that vector once, after that there are many other events that will change the setVelocity, causing the problems you already experienced

    EDIT: A More in depth answer
     
    ne0nx3r0 likes this.
  3. You could get the distance between the two blocks then teleport the player a few blocks each time, stopping when reaching the destination. That might be laggy though :p
     
  4. Offline

    Sammy

    @Adamki11s He said he didn't want teleport solutions, now is going to have a nervous breakdown ^^
     
  5. @Sammy I know but its kinda like dragging the player across the map, just a pretty awful way of doing it :p
     
  6. Offline

    Raphfrk

    In theory, you can work out the gravity and determine an arc.

    The client might even mostly follow it :).
     
  7. Offline

    Sammy

    Can you elaborate on that ? I can't seem to understand why would you use gravity for a linear movement on the x axis, this isn't a friction problem it's just a problem of not updating the vector you want every Onmove event.
    In other words, it's just like @Adamki11s said "its kinda like dragging the player across the map"
     
  8. Offline

    Raphfrk

    I assume that if you tell the player that their velocity is horizontal, the client will implement the appropriate friction.

    It is worth testing one way or another. Ofc, maybe you can move the client through walls, if the server says so.

    Btw, if you move an entity less than 3 blocks at a time, I think that the entity will move to the new location. Players seem to snap to the new location though (maybe other people see them moving though).
     
  9. Offline

    Sammy

    Well that I think is true, friction shouldn't be a problem...
     
Thread Status:
Not open for further replies.

Share This Page