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

Follow Player

Comments in 'Plugin Development' started by AlexBrin, Jul 8, 2016.

  1. AlexBrin
    Offline

    AlexBrin New Member

    Joined:
    Apr 23, 2016
    Posts:
    9
    How to follow the player? To be able to look away from his face and see his inventory
  2. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    PHP:
    $p;
    $ent;

    $yaw atan2($ent->$p->z$ent->$p->x) + 90;
    $p->setRotation($yaw$p->pitch);

    $y = ($yaw 90) * M_PI 180;
    $pitch $p->pitch M_PI 180 * -1;

    $x cos($y) * cos($pitch);
    $y sin($pitch);
    $z sin($y) * cos($pitch);

    $p->setMotion(new Vector($x$y$z));

    ent is the target entiy instance. p is the entity who follows ent.
    Last edited: Jul 9, 2016
    Skullex and Survingo like this.
  3. AlexBrin
    Offline

    AlexBrin New Member

    Joined:
    Apr 23, 2016
    Posts:
    9
    setYaw() is not in the class Player and IPlayer. Tell me, please... :(
  4. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Isn't those properties public?
    Try
    PHP:
    Player::setRotation()
    // or
    Player::setPositionAndRotation()
    Nawaf_Craft1b and Survingo like this.
  5. SOFe
    Offline

    SOFe Banned

    Joined:
    May 28, 2016
    Posts:
    386
    Minecraft User:
    Herobrine
    Meanwhile, neither your title nor the OP specified the subject to follow a player... How do you expect me to know that you're not talking about rotating a Jack-O' Lantern to look at the player?

    And how does "see his inventory" have anything to do with this thread?
    Primus likes this.

Share This Page

Advertisement