Solved Confliciting pitch and roll on armorstand head

Discussion in 'Spigot Plugin Development' started by PartyMC, Oct 20, 2021.

  1. Hey there! I'm making a plugin where I am teleporting multiple armor stands every tick, to simulate rollercoasters. All of the cars of my rollercoaster have rotations (which I can provide in the form of a quaternion, which can also be converted to an EulerAngle). Sadly, when I apply my rotations (I set the yaw using the entity's position, and the pitch and roll using their head pose), and there is a combination of pitch and roll, I get something like this (example situation with both pitch and roll):

    You can see that the front and back edges of the carts don't line up

    Whilst I would like it to look more like this (example situation with no pitch and roll):
    Although it might be harder to see due to the distance between the carts and the unfortunate angle, you can see that the edges point towards each other

    I use quaternions everywhere in my code, except when I convert my rotation quaternion to an Euler so that I can apply it to the armor stand (head pose is an EulerAngle). Does anybody know how I can exactly resolve this issue?

    EDIT: I'll add another picture to clear up the issue a little more. The red line is what it's currently like, and the green one is what it is supposed to be.
  2. Hi ! Did you try this method ?
    Code (Java):
    entity.setRotation(yaw, pitch)
    (see doc here). I think it would resolves your problem.
  3. Setting an armor stand's pitch can only be done using its head pose, unlike other entities. So that doesn't fix my issue.

    EDIT: It looks like this is not an issue with all of my rotation/quaternion code! It probably has to do with my spline code, so I'll mark this thread as solved. If anyone ever has an issue like this, you can send me a message and I might be able to help you out.
    #3 PartyMC, Oct 20, 2021
    Last edited: Oct 22, 2021
    • Agree Agree x 1