Which one sounds more logical

Discussion in 'Plugin Development' started by Official_Spendrew, May 2, 2016.

Thread Status:
Not open for further replies.
  1. I am attempting to create a plugin that involves a player riding a falling block that is riding an armor stand to make the illusion that the player is riding a block. This block will also have some blocks behind it following, acting as a tale. (Example picture below) My question is, would it make more sense to teleport the armor stand at a quick rate or to set the velocity of the armor stand? I have tried the teleporting one but when it teleports its really jumpy (because the player has to be dismounted then teleported) and it leaves behind a ton of armor stands. If setting velocity would make more sense how would I go about doing this. (The player has to be able to control direction). Thank you!
    [​IMG]
     
  2. Offline

    XxTimexX

    Get where player is looking, use vectors to send him in that direction.
     
  3. Offline

    I Al Istannen

    @Official_Spendrew
    You can use the direction the player is looking in for the direction the thing should move. Setting the velocity is smoother (at least I experienced it this way), but can lead to some more bugs (e.g. if one part collides with something), so you might need to combine both.

    Setting the velocity is quite easy, just use the Entity#setVelocity(Vector) to set the velocity and Player#getLocation()#getDirection() to get the direction the player is looking in. You can multiply the direction with something to increase the speed.
     
  4. Thank you, I will give it a try.

    Okay, so I tried this but it doesn't seem to work while the player is on the armor stand. Any ideas as to why this would happen? Can the velocity of an entity not be set when there is a passenger? When I dismout the armor stand it sends me moving as it should.

    EDIT: nvm, I was setting players velocity instead of the entities velocity. :p
     
    Last edited: May 2, 2016
  5. Offline

    Zombie_Striker

    You cannot use entity.teleport when it has a passenger. It's a bug that has yet to be addressed by mojang, so there is no way around it. You would need to set the velocity of the entity in order to move it.
     
Thread Status:
Not open for further replies.

Share This Page