Maintaining passenger rotation

Discussion in 'Plugin Development' started by BeMacized, Apr 11, 2015.

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

    BeMacized

    Hi there

    I'm having a bit of trouble with the rotation of armorstands.

    Situation:
    Player entity has armorstand entity as passenger.
    Armorstand has block set as helmet which is a model.

    I want to control the rotation of the model using the headrotation of the armorstand only.

    Problem:
    When a player entity rotates, eventually after a certain rotation distance, the passenger entity rotates too, adding rotation to the model on its head.

    Is there any way to always keep the passenger armorstand rotated the same way regardless of the rotation of the player which is its vehicle?
     
  2. Offline

    mine-care

    @BeMacized I haven't actually experienced with such a thing in the past AT ALL :O but i can think of a way where you play with PacketPlayOutEntityHeadRotation, you either block it completely (when it is about the entity on the player) or send it constantly to update the rotation to byte 0 so it always faces the same direction. Otherwise there might be a way with The Bukkit API that i am not aware of.
     
  3. Offline

    BeMacized

    Thanks for the reply!

    I'm not sure whether that packet would help me out, since it's not exactly head rotation? It's an armorstand which I think uses poses & eulerangles instead of use its pitch and yaw.

    Also, here's a gif I made of the default rotational behaviour. Note that I did check the yaw constantly, and it seems like the yaw it constant while it's rotating:
    [​IMG]
     
  4. Offline

    BeMacized

    Sorry for the bad manners but ,*Bump*. Still haven't managed to figure this out!
     
  5. Offline

    Zombie_Striker

    Did you look into setting the Yaw and Pitch of the ArmourStand to that of the player? player.getLocation.getDirection().getYaw()
     
  6. Offline

    BeMacized

    Yep, has no effect. While the stand is changing rotation while it's on my head its yaw doesn't change either.
     
  7. Offline

    Zombie_Striker

    I've done some testing. ArmourStands do not rotate, but their heads do. You can set ArmourStand's direction using EulerAnglers. I've set up a basic Rotation. I have not tested to see if the Euler will take .getDirection().getXYZ(), but it should work.
    Code:
            ArmorStand am = getServer().getWorld("dfgs").spawn(new Location(getServer().getWorld("dsgf"),0,0,0),ArmorStand.class);
            EulerAngle e = new EulerAngle(359, 90, 0);
            am.setHeadPose(e);
     
  8. Offline

    BeMacized

    I am completely aware about how their poses work, that's not the issue.

    "ArmourStands do not rotate"
    I beg to differ, see my GIF above.

    As you see in my question, this is not about lose armorstand entities. These entities are placed on the player as a passenger.
     
Thread Status:
Not open for further replies.

Share This Page