How to make spawned fake player look always on the player

Discussion in 'Plugin Development' started by mouz_, Apr 22, 2016.

Thread Status:
Not open for further replies.
  1. What? I substract player's location from fake player's location.

    p.getLocation().getX() - loc.getX();
     
  2. Offline

    mcdorli

    Nevermind.
     
  3. So how to do it?
     
  4. Offline

    mcdorli

    Is it looking away from you or a random direction? If you move, does his head rotate correctly?
    Please post some images if you can.
     
  5. When the yaw and pitch is not set: https://scr.hu/7eA8OY
    When i set yaw and pitch with this code:
    Code:
            double dx = p.getLocation().getX() - loc.getX();
            double dz = p.getLocation().getZ() - loc.getZ();
            double yaw = Math.atan2(dz, dx);
         
            double dx2 = p.getLocation().getX() - loc.getX();
            double dy2 = p.getLocation().getY() - loc.getY();
            double pitch = Math.atan2(dy2, dx2);
         
            wrapper.setYaw((float) yaw);
            wrapper.setPitch((float) pitch);
    https://scr.hu/gyXAqJ

    I think it's the same.
     
  6. Offline

    mcdorli

    If you place it in different direction, does he moves his head?
     
  7. Why would he?
     
  8. Offline

    bennie3211

    I'm not familiar with a fake player, but try to teleport it with the given pitch and yaw like you have to do with players where you edit the yaw and pitch?
     
  9. XDDDDDDDDDD
    1. You can't teleport fake players.
    2. I KNOW HOW TO CHANGE YAW AND PITCH, BUT NONE OF US KNOW WHAT TO CHANGE IT.
     
  10. Offline

    I Al Istannen

    @mouz_
    You can teleport fake players. You just need to send the right packet.
    Laughing at people trying to help is the wrong way, if you want to get help.

    If you set the Yaw and Pitch to random values each time, does the head move? I couldn't extract the information if what you do works. Error might be on my end though.
     
  11. How to teleport fake player? :O
    His head moves when I change it to random values.
    With these methods using Math.atan2 his head is looking in the same direction all the time.
     
  12. Offline

    bennie3211

    0. Good that you think it's funny, but laughing at me for making a mistake while trying to help is stupid.
    1. Okay not the way you think you could, but packets are used when you use fake players.
    2. Using caps isn't needed...
     
Thread Status:
Not open for further replies.

Share This Page