Skip to content

Conversation

Murat65536
Copy link
Contributor

Closes #4750.

@Murat65536 Murat65536 marked this pull request as ready for review May 14, 2025 01:47
@Murat65536
Copy link
Contributor Author

I don't know how do adjust yaw to a 45 degree angle while bridging and honestly, it might actually be better not to. attemptToPlaceABlock isn't just used by MovementTraverse so affecting other things would be bad. I feel like this PR still solves smoothLook being way slower when bridging so I'm going to say it's good.

@Murat65536 Murat65536 requested a review from leijurv July 23, 2025 04:37
@Murat65536
Copy link
Contributor Author

@leijurv Reminder to review.

@Murat65536
Copy link
Contributor Author

@leijurv please I literally had to make a branch from this branch to continue implementing #4838

@Murat65536 Murat65536 requested a review from leijurv August 18, 2025 21:25
@Murat65536
Copy link
Contributor Author

@leijurv ping

@leijurv
Copy link
Member

leijurv commented Aug 26, 2025

it just isn't stable enough to have fully yaw-independent movement
#4752 (comment)

This doesn't make sense to me. How could it be less stable? If you compute an exact combination of yaw, and WASD input, to go in a certain direction, then you set your yaw to exactly that, won't it move in exactly the desired direction? whereas with the current code, it could move up to 22.5° off from the desired direction?

@Murat65536
Copy link
Contributor Author

Murat65536 commented Aug 26, 2025

@leijurv I updated my code to add the change you wanted. That was my reasoning for doing that.
a2a6769

@leijurv
Copy link
Member

leijurv commented Aug 26, 2025

That's really not the same at all.

It doesn't matter which direction the player is already facing. The point is that you'd take the desired direction, and move in EXACTLY that direction, through some combination of WASD and moving the yaw up to 22.5 degrees. Your approach rounds the yaw to a multiple of 45, which would only make sense if the desired direction was also a multiple of 45, which it probably isn't exactly

@Murat65536
Copy link
Contributor Author

Murat65536 commented Aug 26, 2025

My thought process was that attemptToPlaceBlock should set the needed rotation and that all that would be left is rounding the yaw after that.
Edit: I might be seeing some holes in this plan. I can check in 2 hours or tomorrow if I don’t got time. You might be right about the multiples of 45 (but baritone only has traverse and diagonal so idrk. I still want to fix it)
Edit 2: Yea, I should be doing modulus 45 or something my bad

@leijurv
Copy link
Member

leijurv commented Aug 27, 2025

The procedure should be

  1. Attempt to place a block. This defines the approximate yaw that we want to be looking at.
  2. Move towards the next block. This defines the EXACT direction we will move in.

Call those yaw1 and yaw2. We want to look as close as we can to yaw1, while moving towards yaw2.

We will go through all the possible MovementOptions. For each one, we will compute it in reverse. Instead of "if I looked at this yaw and did this movement, which direction would I go?", we need the opposite: "if I did this movement and I wanted to go in this direction, what yaw would I need?". We will pick the MovementOption that wants a yaw closest to yaw1. Call that yaw3.

So, we have picked a MovementOption, where if we look in direction yaw3, the player will move EXACTLY towards yaw2. Of all movement options, this one was chosen because it's the closest to yaw1, but it probably doesn't exactly equal yaw1.

We will then do that movement option while looking at yaw3. This means we will MOVE exactly towards the target block, but the direction we will look for placement will be slightly off. But that's really not a problem since the area where we can place a block is pretty big.

@kittenvr
Copy link

could you also make a mode that just sprints while extend scafolding

@Murat65536
Copy link
Contributor Author

Like the scaffold hack? I don't really have much experience with scaffold but I doubt that change is going to happen now. Lets at least get some more legit bridging methods in before we focus on something not everyone uses. I'm doing this because I want to look around in 3rd person while bridging, I want to bridge faster with smoothLook, and I want to implement attacking (this is one step of that).

@Murat65536
Copy link
Contributor Author

Ok, now it should be all good. Yaw distance is annoying

@Murat65536
Copy link
Contributor Author

Murat65536 commented Aug 29, 2025

The procedure should be

  1. Attempt to place a block. This defines the approximate yaw that we want to be looking at.
  2. Move towards the next block. This defines the EXACT direction we will move in.

Call those yaw1 and yaw2. We want to look as close as we can to yaw1, while moving towards yaw2.
We will go through all the possible MovementOptions. For each one, we will compute it in reverse. Instead of "if I looked at this yaw and did this movement, which direction would I go?", we need the opposite: "if I did this movement and I wanted to go in this direction, what yaw would I need?". We will pick the MovementOption that wants a yaw closest to yaw1. Call that yaw3.
So, we have picked a MovementOption, where if we look in direction yaw3, the player will move EXACTLY towards yaw2. Of all movement options, this one was chosen because it's the closest to yaw1, but it probably doesn't exactly equal yaw1.
We will then do that movement option while looking at yaw3. This means we will MOVE exactly towards the target block, but the direction we will look for placement will be slightly off. But that's really not a problem since the area where we can place a block is pretty big.

@leijurv
Just as an overview, this is what I did:
I thought of the player as a point with one ray coming out of said point at an angle of the current yaw.
I then thought of 7 more rays at 45 degree offsets from the current yaw (which would make them an equal distance away from each other) to represent the other directions the player can take.
I drew one last ray to represent the ideal yaw.
Since Minecraft's yaw system works by going 0 to 180, then straight to -180 and back down to 0, I did some math in yawDistanceFromOffset to calculate the shortest distance between the current yaw ray and the offset yaw ray.
Since I know for a fact that every 45 degrees there's going to be another ray, I can safely do modulus 45 to only get the discrepancy in the yaw that I need to account for.
After this, I need to figure out if the discrepancy in the yaw would be smaller by turning left or right, which I do with a little more math in moveTowardsWithSlightRotation.
That should be it, but there's always a chance that it's not. LMK if you find anything.

@Murat65536
Copy link
Contributor Author

@leijurv sorry for asking so many times but review please.

@leijurv
Copy link
Member

leijurv commented Sep 11, 2025

Yeah that looks like it could be right, it's a bit weirdly written so I can't quite tell from reading. If you send a screen recording of it working, that shows how it works (like, with freelook turned off), then I'll merge I think

@Murat65536
Copy link
Contributor Author

2025-09-11.15-52-04.mp4

@leijurv leijurv merged commit d196c64 into cabaletta:1.19.4 Sep 11, 2025
4 checks passed
@Murat65536 Murat65536 deleted the bridging-improvements branch September 11, 2025 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve Bridging
3 participants