Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Mob Look at me

Comments in 'Plugin Development' started by CookieSteve, May 19, 2015.

  1. CookieSteve
    Offline

    CookieSteve Active Member

    Joined:
    Apr 22, 2014
    Posts:
    132
    Minecraft User:
    iStrqfeChris
    What's the code to get a mob to move his head when I walk close to him
  2. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    I use this:

    PHP:
      $this->yaw rad2deg(atan2(-$dir->getX(),$dir->getZ()));
      
    $this->pitch rad2deg(atan(-$dir->getY()));
    Where $dir is a Vector3 with the direction towards the player (i.e. magnitued is 1).

Share This Page

Advertisement