Hello
How can i move player?
NOT teleport
I need an effect like when player press W
I have an idea - spawned entity (for example chiken) behind the player can move him
But mabe there are more useful ways?
To move a player without teleporting. You need to offer a Key.VELOCITY to the entity
Thanks
player.offer(Keys.VELOCITY, new Vector3d(1, 0, 0));
Do you know, i have to count the Vector3d to push player straight or Sponge have tools to get Vector3d from facing point?
Yep. So by getting the Transform of the player. Then get the rotation of that (it is the players rotation - x = pitch, y = yaw, z = roll) after that you will need to convert that into xyz (I believe there is one that converts it into a Direction and then direction can easily be converted into a vector).
Sadly there is currently no sponge api on converting a entities looking direction into movement
The category Server Discussion is not appropriate for this kind of questions. You should ask in the Plugin Development category, or you can join us on Discord to get faster answers.
You can do this by converting the value into a Quaternion
with Quaternion.fromAxesAnglesDeg()
. Then you can convert that back into a Vector3d
you can use by calling getDirection()
.