How to turn armorstand face to entity?

Discussion in 'Plugin Development' started by Archangel526, Mar 9, 2021.

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

    Archangel526

    I want to turn armorstand face to another entity, how can i get required yaw?
     
  2. Offline

    KarimAKL

    @Archangel526 I believe something like this should work:
    Code:Java
    1. Entity entity;
    2. ArmorStand armorStand;
    3.  
    4. Vector direction = armorStand.getLocation().toVector().subtract(entity.getLocation().toVector());
    5.  
    6. armorStand.teleport(armorStand.getLocation().setDirection(direction));

    However, this is untested, so it might not work.
     
    Archangel526 likes this.
  3. Offline

    Archangel526

    Thank you, that worked
     
    Last edited: Mar 9, 2021
    KarimAKL likes this.
Thread Status:
Not open for further replies.

Share This Page