Skip to content

Difference in coordinate system conversion between Forge and Fabric mods #55

@magneticflux-

Description

@magneticflux-

I recently realized (https://github.com/magneticflux-/fabric-mumblelink-mod/issues/80) that the Forge and Fabric mods have different methods of converting coordinate system handedness. Both methods work, it's just that they result in different left-hand coordinate systems that are incompatible.

Forge:
x,z,y

fAvatarPosition = new float[]{
(float) game.player.getPosition(1f).x(),
(float) game.player.getPosition(1f).z(),
(float) game.player.getPosition(1f).y()
};

Fabric:
x,y,-z
https://github.com/magneticflux-/fabric-mumblelink-mod/blob/develop/src/main/kotlin/com/skaggsm/mumblelinkmod/client/MathUtils.kt#L12

From Wikipedia:

Interchanging the labels of any two axes reverses the handedness. Reversing the direction of one axis (or of all three axes) also reverses the handedness.


From the documentation:

X increases towards your right, Y increases above your head, and Z increases in front of you

It recommends having "Y" be above the head, which can be preserved by negating either the X or Z axes (The Fabric mod negates the Z axis).

I see two options going forward:

Option 1:

Change the Forge mod to match the Fabric mod.

Pros:

  • Preserves the recommended "Y is up" property

Option 2:

Change the Fabric mod to match the Forge mod.

Pros:

  • Only breaks compatibility with the smaller (I assume) userbase

As it is now, the Fabric and Forge mods are still incompatible due to this issue. It results in confusing behavior because the sounds work in some situations (around 0,0,0), but come from the wrong locations.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions