1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Motion updating on hit

Discussion in 'Development' started by Swourire, Apr 22, 2019.

  1. Swourire

    Swourire Spider Jockey

    Messages:
    49
    GitHub:
    swourire
    Hello, I'm trying to make a plugin where an entity follows a player, I got everything alright, but I get stuck because the update movement that I made on EntityBaseTick updates everytime I hit, I'd like it to update simply everytime.
     
  2. DiamondGamer30

    DiamondGamer30 Baby Zombie

    Messages:
    175
    GitHub:
    diamondgamermcpe
    Can you show what you’ve put in the function?
     
  3. Swourire

    Swourire Spider Jockey

    Messages:
    49
    GitHub:
    swourire
    PHP:
    public function updateMove($tickDiff){
            
    $yaw $this->target->getYaw();
                
    $this->yaw $yaw 180;
                
    $this->move($this->target->motion->getX() - $this->motion->1.35$this->target->motion->getY() - $this->motion->1$this->target->motion->getZ() - $this->motion->1.35);
                return;
                  
        }
    this is how I move player, also the head is rotating without me having to hit the human, but the move is only when I hit
     
  4. SavionLegendZzz

    SavionLegendZzz Slime

    Messages:
    75
    GitHub:
    savionlegends
    It seems like the variable $target is only acquired when you hit the entity can you show the whole code?
     
  5. Swourire

    Swourire Spider Jockey

    Messages:
    49
    GitHub:
    swourire
    I figured it out thx for help tho.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.