Solved SetYaw not working?

Discussion in 'Plugin Development' started by TheEnderman, Oct 6, 2016.

Thread Status:
Not open for further replies.
  1. Hey guys,
    For some reason, .setYaw doesn't appear to be working for me.
    I have tried:
    p.getEyeLocation.setYaw(90F)
    and
    Location tpto = new Location(p.getWorld(), p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ());
    tpto.setYaw(90F);
    tpto.setPitch(0F);
    p.teleport(tpto);

    None of these do anything when I call the method.
     
  2. @TheEnderman
    The second one works for me when I test it. Show us in what context you use it.
     
  3. public static void cin() {
    for (Player p : link.getServer().getOnlinePlayers()) {
    Location tpto = new Location(p.getWorld(), p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ());
    tpto.setYaw(180F);
    tpto.setPitch(0F);
    p.teleport(tpto);
    p.setVelocity(new Vector(0, 2, 0));
    }
    }

    Method cin is being called by another class

    @AlvinB

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Oct 6, 2016
  4. @TheEnderman
    What if you try printing out something in that block of code to see if it actually gets executed?
     
  5. @AlvinB Using the 2nd method, the player gets teleported to their current position but their view is unchanged.
     
  6. @TheEnderman
    Well, are you already facing the direction you're being teleported to?
     
  7. @AlvinB I am 100% certain as I have looked in many directions and called the method

    EDIT: It appears that I got setYaw and setPitch incorrect
     
    Last edited: Oct 7, 2016
Thread Status:
Not open for further replies.

Share This Page