Skip to content

Comments

Add bobbing#2546

Open
lukaswrz wants to merge 15 commits intoPixelGuys:masterfrom
lukaswrz:bobbing
Open

Add bobbing#2546
lukaswrz wants to merge 15 commits intoPixelGuys:masterfrom
lukaswrz:bobbing

Conversation

@lukaswrz
Copy link

@lukaswrz lukaswrz commented Feb 9, 2026

This PR adds bobbing so that walking doesn't feel "on-rails".

@RanPix
Copy link
Contributor

RanPix commented Feb 9, 2026

could you please upload a video of how that looks?

@lukaswrz
Copy link
Author

lukaswrz commented Feb 9, 2026

Sure: https://youtu.be/MIPdgzWBX_c

@RanPix
Copy link
Contributor

RanPix commented Feb 9, 2026

yes.

@BoySanic BoySanic moved this to Low Priority in PRs to review Feb 13, 2026
@ikabod-kee
Copy link
Collaborator

I'm going to try this out!

Copy link
Collaborator

@ikabod-kee ikabod-kee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how you did it, but you managed to get it feeling right on the very first try. No complaints from me. Well done!!

(Now we just have to make our up & down bobbing meet the same quality as this!)

@BoySanic
Copy link
Contributor

Can we add an option for enabling/disabling bobbing?

@lukaswrz
Copy link
Author

Can we add an option for enabling/disabling bobbing?

Should that disable the vertical movement (i.e. when jumping/falling) as well (which is what Minecraft does, for example), or should it just disable the bobbing that is being added by this PR?

@ikabod-kee
Copy link
Collaborator

2026-02-13.14-28-29.mp4

It seems the animation doesn't reset when stopping and starting. Also a slow fade-in like you suggested in the Discord would make sense!

@ikabod-kee
Copy link
Collaborator

2026-02-13.14-28-29.mp4

Also when jumping around, the item always seems to go to the right position, even when jumping when it's positioned to the left.

@ikabod-kee
Copy link
Collaborator

Wait I just posted the same video twice 😭 my bad.

2026-02-13.14-31-39.mp4

@IntegratedQuantum
Copy link
Member

One thing that is weird is how fast the bobbing frequency slows down when you move slower. It feels like one of these toys that have wave their arm as you move them over the ground.

In real life if you walk slower, then your step length also reduces, ranging from maybe 1/4 of a meter to several meters when sprinting. Here your step length seems to be constant.

* Add bob intensity with fade in and fade out
* Set a minimum for movementScale for calculating bobPhase
* Don't revert bobbing while jumping
* Reset bobPhase and bobIntensity when flying
@lukaswrz
Copy link
Author

It seems the animation doesn't reset when stopping and starting

This is intentional. I think it would look weirder if the item being held just kept going in the same direction every time you pressed W. That said, I don't think it matters all that much, since this isn't something that you would be doing during actual gameplay.

@lukaswrz
Copy link
Author

lukaswrz commented Feb 13, 2026

@ikabod-kee Feel free to test it again, I've made some changes that should make it look better.

@ikabod-kee
Copy link
Collaborator

Alright! I'll get to it soon

Copy link
Collaborator

@ikabod-kee ikabod-kee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, this is definitely a lot better now! I will make one suggestion right quick though:
Could you make it so the hand slows down its animation when jumping instead of immediately stopping?

@ikabod-kee
Copy link
Collaborator

Also, when they are airborne, could you make it so the hand (very) slowly goes back to the original position? (with some easing, of course)

image

@ikabod-kee
Copy link
Collaborator

Another complaint: The fade-in for going from stopped to running is too long.
Sorry to be a bother about these adjustments!

@lukaswrz
Copy link
Author

lukaswrz commented Feb 13, 2026

The fade-in for going from stopped to running is too long

Can you tell me the value that you'd prefer? You can test a few values by adjusting the fadeInSpeed.

Sorry to be a bother about these adjustments!

No worries, all good.

@ikabod-kee
Copy link
Collaborator

Can you tell me the value that you'd prefer? You can test a few values by adjusting the fadeInSpeed. The max is 1.

Sure, I can tell you! Where can I find this setting?

@lukaswrz
Copy link
Author

It's a constant defined in the code. I don't think it makes sense to introduce a GUI setting for this, instead, I just added one to turn bobbing on or off entirely, because I think that's what most players would be looking for.

@ikabod-kee
Copy link
Collaborator

Where is it in the code? I'm not a programmer XD

@lukaswrz
Copy link
Author

Line 580 in src/itemdrop.zig.

@ikabod-kee
Copy link
Collaborator

I decided on 5.0 as the "fadeInSpeed" value, because I like how snappy it feels. You immediately know when you are walking!
As for the "fadeOutSpeedOnGround," I couldn't notice a difference when changing it.

@ikabod-kee
Copy link
Collaborator

I actually think having it be an immediate start/stop when pressing the walk keys would make it feel extremely responsive! The only issue I really have with the bobbing otherwise would how it acts when airborne.

@lukaswrz lukaswrz requested a review from ikabod-kee February 14, 2026 02:32
Copy link
Collaborator

@ikabod-kee ikabod-kee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You managed to fix most of my complaints with this recent commit! It's pretty much ready to merge, but I ask that you try to make the animation reset when stopped so that the bobbing goes right every time you begin walking. I believe this will help a bit in its "feel."

Basically "trust me bro."

@ikabod-kee
Copy link
Collaborator

Oh, and if you can, could you make it so going into fly mode doesn't immediately jerk it like this?

2026-02-13.22-12-43.mp4

@ikabod-kee
Copy link
Collaborator

It'd also be nice to have the player only bob when a movement key is held, so it doesn't look like they're walking on ice when they're sliding (because you know, they're sliding.)

You don't have to do this one as I feel tying it to movement keys may leave a slight period in between switching directions that can stop the animation. Unless you want to. It's just a "would be nice to have" thing.

2026-02-13.22-27-30.mp4

@lukaswrz
Copy link
Author

Going into fly mode is smoother now, and sliding on ice should look better as well.

Copy link
Collaborator

@ikabod-kee ikabod-kee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PERFECT!!

@ikabod-kee
Copy link
Collaborator

I love the little detail you added where the item gets lowered when crouch-walking.

@IntegratedQuantum
Copy link
Member

I've noticed that running down feels kind of weird with the way the animation resets in the air:

video-2026-02-15_10.30.38.mp4

@lukaswrz
Copy link
Author

I've made some adjustments to the animation reset speed (e.g., when running down hillsides). It's fairly subjective, but I'm pretty happy with how it looks now.

@ikabod-kee ikabod-kee added this to the Version 0.2.0 milestone Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Low Priority

Development

Successfully merging this pull request may close these issues.

5 participants