I don't know, would the move() method work? PHP: $entity->move($vector->getX(), $vector->getY(), $vector->getZ());
Here: PHP: // + 6.5235748291016 x$wishX = 87;$wishZ = 49;$x = ($wishX - $pl->x) / 6.5235748291016;$z = ($wishZ - $pl->z) / 6.5235748291016;$pl->setMotion(new Vector3($x, 1, $z));
To clarify, I simply just want an entity (custom one) to walk towards a specific vector. Also, what would I need in a class that extends Entity? So far, I've found 3 functions: Level::addEntityMovement, Level::addEntityMotion and Entity::move. I don't understand what is the difference between movement and motion though.
That should work PHP: $X = 128;$Z = 128;$entity->setRotation(rad2deg(atan2($Z - $player->z, $X - $player->x)) - 90, 0);$yaw = ($entity->yaw + 90) * M_PI / 180;$pitch = $entity->pitch * M_PI / 180 * -1;$x = cos($yaw) * cos($pitch);$z = sin($yaw) * cos($pitch);$mot = new Vector3($x / 2, 0, $z / 2);$entity->setMotion($mot);
So $x and $z is the target coordinates, right? Do I just put it where I want it to move or do I have to put it in the Entity class of mine?
Can someone set an example of where I would put that? I am not too sure and don't have enough time to test Sorry