How can I change player's pitch without teleporting

Discussion in 'Plugin Development' started by iZanax, Sep 13, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    iZanax

    Code of how to change pitch WITH teleport ; (
    Code:
    Location loc = event.getPlayer().getLocation();
    loc.setPitch((float) (event.getPlayer().getLocation().getPitch() - 0.5));
    event.getPlayer().teleport(loc);
    I want to change the pitch of a player, is it possible to change it without teleporting?
    Because when your teleport to change pitch, the player will stop moving, so its pretty glitchy and not what i need.
     
  2. what is it that you need to be done? what is the purpose or effect you want to accomplish?
     
  3. Offline

    iZanax

    Effect: Recoil
    Explain: When event is triggerd then add x to the pitch of the player, to make it looks like the player has recoil
     
  4. Offline

    stelar7

    Like this, I think
    Code:
    player.getLocation().setPitch(player.getLocation().getPitch()-0.5);
     
  5. Offline

    Firefly

    No, since that would only change the value of the Location and not affect anything (which is why you need teleport())

    What you said would be like saying this works to teleport the player up 5 blocks: player.getLocation().setY(player.getLocation().getY() + 5);
     
  6. Offline

    stelar7

    Would atleast make it alot easier xD
     
  7. Offline

    iZanax

    Hmmm,
    I can use teleport, but it has to teleport the player to exact location and not to the middle of that block he was on. That is the issue that make moving while chaning pitch impossible, So how do i teleport to the exact location?
     
  8. Offline

    TheTrixsta

    Dont get the block their on, just get the X,Y,Z as a double.
     
  9. Offline

    iZanax

    *Bump*

    Code:
    Code:
                Location loc = new Location(event.getPlayer().getWorld(), event.getPlayer().getLocation().getX(),event.getPlayer().getLocation().getY(),event.getPlayer().getLocation().getZ());
                loc.setPitch((float) (event.getPlayer().getLocation().getPitch() - 0.5));
                event.getPlayer().teleport(loc);
    Got the x,y,z but the same deal. while event is active, the player will stand on the coordinate and can't move properly ( teleported back to xyz),
    So is there any other way to change pitch of a Player without teleport?
    If there isn't yet, then I get whipe this feature of the list. : )
     
  10. Offline

    zachoooo

    Bump I need something similar
     
  11. Offline

    fireblast709

    too bad Java tells me that there is no method b(float, float) method in the code, even though I found one in the NMS class Entity -_- (sidenote this is the setRotation method, which changes the yaw and pitch)
     
  12. Offline

    iZanax

    There is a Packet for it, but it gived IO excpetion, if I can remember.
    PlayerLookPacket.
    Dunno if some Packet API's that is available and
    can send it without IO Exception...
     
  13. Offline

    fireblast709

  14. Offline

    iZanax

Thread Status:
Not open for further replies.

Share This Page