Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
magneticflux- opened this issue Nov 1, 2021 · 2 comments
Assignees
Labels

Comments

@magneticflux-
Copy link
Collaborator

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.

@magneticflux-
Copy link
Collaborator Author

@zsawyer This should probably be done in the update to 1.18 to avoid breaking compatibility.

Special attention should be paid to #35 to ensure the correct coordinate is offset.

@zsawyer
Copy link
Owner

zsawyer commented Dec 12, 2021

Summary: I will change the Forge mod for 1.18

The handedness seems to indeed be the problem.
I would like to have the solution be the correct transformation from Minecraft's system to Mumble's system - what ever that may be.

Back in the days when I was developing the mod Mumble and Minecraft would actually use different vectors for "up".
Z and Y was simply switched. It seems like that has been changed at some point in time?

From my understanding Y is now up in both MC and Mumble. However Mumble uses a left-handed (as per documentation) and minecraft a right-handed coordinate system (tested using F3 ingame).

I would say that simply transforming for the handedness is the right approach.

While I would have preferred to invert the x-axis - since you already have it done to the z-axis I will adapt the Forge mod accordingly.

@zsawyer zsawyer self-assigned this Dec 12, 2021
zsawyer pushed a commit that referenced this issue Jan 24, 2023
conversion scheme still converts Minecraft's a right-handed system to Mumble's left-handed system but using a different approach (switching z axis instead of previously swapping z and y axis)

fixes #55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants