Skip to content

8719a81 breaks bone overrides in some circumstances #15692

Description

@appgurueu

This regression applies if you set a bone override on a bone with a perfect rotation (rotation matrix just flips the signs of some axes, e.g. 180° rotations around one axis).

8719a81 breaks playeranim and character_anim.

Both these mods "re-animate" the player (originally for the reason that 5.2 and lower did not support overriding single bones), that is, they calculate bone transforms in pure Lua for all bones and apply them via bone overrides.

The problem boils down to the fact that both these mods override the Body bone rotation to identity, when they should override it to a 180° rotation around the Y axis. It's easy to see that these mods are in the wrong by inspecting character.b3d and observing that this is what the body rotation should be (as a quaternion, that's 0, 1, 0, 0 in XYZW order).

Problem is, older Luanti would falsely decompose a perfect 180° Y axis rotation (which is represented exactly this way in the b3d model!) into a -1, 1, -1 scaling and an identity rotation. In other words: These mods are working around an older Luanti bug. I now fixed this bug, and now these mods are setting wrong rotations for all bones that have such perfect rotations:

Image

The bugs are relatively easy to pinpoint:

Furthermore the manual head rotation needs to be fixed.

For a mod to be affected, it needs to apply a bone override to a bone which is rotated by exactly 180° around one of the cardinal axes, thereby inverting the other two axes. This means there will likely be more affected mods than these two.

Impact:

  • playeranim has ~1.5k downloads on CDB. character_anim has ~43k downloads.
  • playeranim serves a total of ~50 players on only 5 servers at the time of this writing, the most notable being Your Land (@Bastrabun) and Blocky Survival with 30 and 15 players respectively. character_anim serves ~10 players on a few more servers.
  • Even if we fix the mods, it's still bad:
    • New clients joining servers running older versions of these mods will see players incorrectly.
    • Older clients will see the models incorrectly, because they are sent the same overrides.
Affected servers

Image
Image

Possible solutions:

  • headanim is a decent alternative that is unaffected by these changes, but only works on 5.3+. This seems a good compromise to me so far.
  • Put the bug back in. Not a decent option long term. May be a decent option for 5.11.
  • Put the bug back in, but behind a flag. May be a bit tricky, but could work. I don't like having to enable "correct" behavior though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    @ Client renderingDiscussionIssues meant for discussion of one or more proposalsNot a bugThe behaviour is working as intended and won't be changedRegressionSomething that used to work no longer does

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions