setPitch() and setYaw() not working.

Discussion in 'Plugin Development' started by Desle, Feb 15, 2014.

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

    Desle

    Code:
    Location endLocation = new Location(endWorld, endX, endY, endZ, (float)endYaw, (float)endPitch);
    This doesn't work.. same goes for
    Code:
    Location endLocation = new Location(endWorld, endX, endY, endZ);
    endLocation.setYaw((float) endYaw);
    endLocation.setPitch((float) endPitch);
    
     
  2. Offline

    rbrick

    Instead of casting it as a float. Define it as a float.
    Code:java
    1. float endPitch = p.getLocation().getPitch();
    2.  
    3. float endYaw = p.getLocation().getYaw();

    maybe?
     
    Desle likes this.
  3. Offline

    Conarnar

    What exactly isn't working?
     
  4. Offline

    xTrollxDudex

    Desle
    Teleport the entity to its own location after setting yaw/pitch, or is that not your problem?
     
  5. Offline

    Desle

    xTrollxDudex

    I'm not sure what the problem you solved is..
    Do you mean I should use that for updating the location?

    Sorry for late reply.

    Conarnar
    It's not setting.
     
  6. Offline

    xTrollxDudex

    Desle
    How do you know it isn't setting? You never did anything with it.
     
  7. Offline

    rbrick

    xTrollxDudex means
    Code:java
    1. entvar.teleport(world,x,y,z);
    2.  
    3. entvar.setYaw(yawvar);
    4. entvar.setPitch(pitchvar);

    forgot about having to do that on teleport lol!
     
  8. Offline

    _Filip

    rbrick
    No, that is not what he means.
    He means:
    Code:java
    1. locvar.setYaw(yawvar);
    2. locvar.setPitch(pitchvar);
    3.  
    4. playervar.teleport(locvar);
     
  9. Offline

    Desle

    swampshark19
    rbrick xTrollxDudex
    I'm trying to retrieve the location info from a yml file and then store it in a location.. although it doesn't save the yaw and pitch..

    This is how i do it:
    Code:
                Location endLocation = new Location(endWorld, endX, endY, endZ, (float)endYaw, (float)endPitch);
     
Thread Status:
Not open for further replies.

Share This Page