How to set an entitys rotation?

Discussion in 'Plugin Development' started by 2rockon, Jun 9, 2011.

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

    2rockon

    Im currently developing a plugin which requires me to set an entitys rotation, to the same of another entity. How could I do this/is it even possible?

    Many Thanks
    2rockon
     
  2. Offline

    nisovin

    Rotation is part of an entity's location. You can set the location to set the rotation.
     
  3. Offline

    robin0van0der0v

    Try this. ;)

    Code:
    entity.getLocation().setPitch(pitch);
    entity.getLocation().setYaw(yaw);
     
  4. Offline

    2rockon

    I got it working with the following code:

    Code:
    Location loc = pig.getLocation();
    
    loc.setPitch(MountsPlayerListener.playerpitch);
    loc.setYaw(MountsPlayerListener.playeryaw);
    pig.teleportTo(loc);
    But when the player is riding the pig it doesnt work, as this was what was confusing me. I will have to look into this more tomorrow. I guess it's because minecraft code is fighting this.

    2rockon
     
Thread Status:
Not open for further replies.

Share This Page