Quick question: Does a NEW location have a pitch/yaw?

Discussion in 'Plugin Development' started by ChipDev, Dec 25, 2014.

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

    ChipDev

    Hey,
    Quick question I just thought of:
    If i were to make a new Location(), and not do Location#setYaw() Location#setPitch(), Will it HAVE a yaw & pitch? Or will it be 0? or null?
    Thanks,
    Me.
     
  2. Offline

    Xtreme727

    The fact that pitch and yaw are like x/y coordinates for your turns etc., I'm pretty sure it would be 0
     
    ChipDev likes this.
  3. Offline

    coasterman10

  4. Offline

    fireblast709

    @ChipDev primitives cannot be null. Even if they weren't initialized, they would be 0 by default. (Fun fact: assigning null to a primitive throws a NullPointerException)
     
  5. Offline

    Rocoty

    @ChipDev What happened when you tried it?
     
  6. Offline

    Funergy

    @ChipDev Its automaticly 0
    but if you want to keep it the pitch and yaw of the player just do
    Location pLoc = player.getLocation();
    pLoc.setX(the x value);
    pLoc.setY(the y value);
    pLoc.setZ(the z value);

    and then teleport or do whatever you want with the location pLoc
     
  7. Offline

    ChipDev

    Well, I didn't :p It popped into my mind.
     
  8. Offline

    Rocoty

    @ChipDev I think you'll find that actually trying it will give you the result much faster than asking on the forums. You are also gonna learn more that way.
     
  9. Offline

    ChipDev

    True.
     
Thread Status:
Not open for further replies.

Share This Page