Shoulder Surfing Reloaded

Shoulder Surfing Reloaded

20M Downloads

Incompatible with Gravity Changer

TheVisionaryOne opened this issue ยท 7 comments

commented

Description

When the player is influenced by any alternate gravity source, the camera phases into the floor (or wall, depending on how you look at it). Strangely, the camera temporarily fixes itself while the player is midair. As far as I am aware, this compatibility issue is not currently solvable with a config setting.

I demonstrated this issue using custom zones from Loquat, which are simply applying the command "/effect give @A gravity_changer:south" whenever a player enters them. This issue occurs even with only the Gravity Changer and Shoulder Surfing mods present, and can be replicated by simply typing that command in chat, with any desired gravity direction.

Example:
https://youtu.be/NHpb5hNfB34

I would love to see some compatibility between Shoulder Surfing and Gravity Changer, for some epic alternate gravity platforming possibilities!

P.S: Please ignore the ridiculously long camera Y distance. I've tested the issue on multiple camera distances, and determined that is not the cause of the problem. I know the camera distance is beyond the recommended amount, but it's personal preference. It was an extremely pleasant surprise to discover that I could change the Y value beyond 1.79 haha

Minecraft version

1.20.1

Incompatible mod name

Gravity Changer (qouteall fork)

Incompatible mod version

Gravity Changer v1.1.2

Game Logs

https://mclo.gs/umJPpCb

commented

Thanks for the detailed report! I already pushed some changes to the 1.20.1 branch, which fix the position of the camera. The only thing that does not work yet is the look rotation of the player player when aiming or interacting. In order to get that working, Gravity Changer or Gravity API needs to implement a gravity sensitive version of the Entity#lookAt(anchor, yRot, xRot) method. I suggest reporting this in their repos.

commented

Wow! That was fast! Just tested it, and I'm so glad to see the camera not clipping into the ground anymore! After playing around with it for a bit though, I did notice a new issue.

When switching from one gravity direction to another, the player direction will sometimes be incorrectly changed (usually reversed). It doesn't always happen, but some specific gravity switches (e.g. south -> west) seem to consistently trigger this issue. This makes switching between certain gravity directions in third person extremely difficult. If the player simply holds the W-key, they will eventually be caught in an infinite loop of switching in-between the same two gravity zones, like a game of ping-pong!

Example:
https://youtu.be/Bv8NjbQg4ZU

Although I initially thought this would be a standalone Gravity Changer issue, I discovered that this issue only happens when using Shoulder Surfing. When using the vanilla first-person or third person views, this issue does not occur at all. That said, I understand it's very possible this is another compatibility issue on Gravity Changer's side, since it has to do with player look rotation.

Thank you for fixing the camera position, and please let me know if this seems like a Shoulder Surfing issue, or rather something I should tack on to my Gravity Changer issue report.

commented

When switching from one gravity direction to another, the player direction will sometimes be incorrectly changed (usually reversed). It doesn't always happen, but some specific gravity switches (e.g. south -> west) seem to consistently trigger this issue. This makes switching between certain gravity directions in third person extremely difficult. If the player simply holds the W-key, they will eventually be caught in an infinite loop of switching in-between the same two gravity zones, like a game of ping-pong!

Would it be possible for you to share the world from the video?

commented

Thank you for sharing the world and the detailed description, it really helped getting started! As I already expected, Gravity Changer/Gravity API adjust the pitch and yaw of the player when gravity is changed (see source code here). The problem is that the camera rotations do not get adjusted, as Gravity Changer/Gravity API is not aware of Shoulder Surfing, which possesses its own pitch and yaw rotations for the camera. The following screenshots illustrate the movement from the bottom side of the cube (up gravity) to the south side of the cube (north gravity), without moving the mouse:

2024-05-20_12 25 38

2024-05-20_12 25 52

Note that the pitch of the player changes from -3.3 to 176.7, but the pitch of the camera (controlled by Shoulder Surfing) does not change. The bug can also be triggered when changing the gravity direction to the exact opposite (for example, moving from the upper side of the cube to the bottom side of the cube, without touching and other gravity zones).

Although it would be possible for me to hook into the method that is responsible for the rotation changes via mixins, I do not want to depend on the internals of Gravity Changer/Gravity API, as there is no event/api for this specific use case and the code could change at any time. Instead, I would prefer if Gravity Changer/Gravity API would depend on Shoulder Surfing, or implements an event within their api. They could set the camera pitch (y-rot) and yaw (x-rot) using the following methods:

ShoulderRenderer.getInstance().setCameraX(float xRot);
ShoulderRenderer.getInstance().setCameraY(float yRot);

Those methods are specifically for usage by other mods and are unlikely to change. You may want to report this to the authors of Gravity Changer and/or Gravity API.

commented

Absolutely! Keep in mind that the gravity zones I'm testing here are made with Loquat, and are not included in the Gravity Changer mod by default. I double-checked by testing the default Gravity Changer arrows, I can confirm this is a compatibility issue between Gravity Changer and Shoulder Surfing. Loquat is not involved.

I believe the Loquat zones should be included in the world file. If you'd like to use them, you'll also need to install KubeJS, and drag the included gravity.js script into the kubejs>server_scripts folder in your .minecraft installation. Otherwise, the zones will not give you the gravity effect. I found Loquat's zones to be the easiest way to test the gravity issues, although it is also possible to reproduce this effect with Gravity Changer's default commands/items.

World File:
Shoulder Surfing Gravity Test.zip

After some more testing, I have also discovered I was wrong with my original theory on which gravity directions are causing this bug. It seems like two directions specifically (Up and Down) are the problematic ones. The North, South, East and West gravity directions all seem to operate normally. However, switching from any of those 4 gravity directions into Up or Down is what produces the weird camera rotation bug. I'm not sure if I'm just imagining this, but it seems like certain combinations are more jarring than others, based on how much they artificially rotate the player camera. Transitioning from Down gravity into South gravity seems to be particularly bad.

Let me know if there's anything else I can do to help with testing this issue!

commented

Ahh yup, that makes sense. Player rotation changes but the camera does not. I'll go ahead and report this on the Gravity Changer repos as well then. Thank you for the help!

commented

I will also extract the aforementioned methods to an interface, which will be included in the api package, so other mods that depend on shoulder surfing can soley depend on the api jar and not the actual, modloader dependent, jar of shoulder surfing.