pocketmine\entity\Entity::setMotion PHP Method

setMotion() public method

public setMotion ( Vector3 $motion )
$motion pocketmine\math\Vector3
    public function setMotion(Vector3 $motion)
    {
        if (!$this->justCreated) {
            $this->server->getPluginManager()->callEvent($ev = new EntityMotionEvent($this, $motion));
            if ($ev->isCancelled()) {
                return false;
            }
        }
        $this->motionX = $motion->x;
        $this->motionY = $motion->y;
        $this->motionZ = $motion->z;
        if (!$this->justCreated) {
            $this->updateMovement();
        }
        return true;
    }