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

CharacterBody2D jiggles when going up against a wall from a slope #79435

Open
lucuinhas opened this issue Jul 13, 2023 · 3 comments
Open

CharacterBody2D jiggles when going up against a wall from a slope #79435

lucuinhas opened this issue Jul 13, 2023 · 3 comments

Comments

@lucuinhas
Copy link

lucuinhas commented Jul 13, 2023

Godot version

4.1.stable

System information

Godot v4.1.stable - Windows 10.0.22000 - Vulkan (Forward+) - dedicated GeForce MX350 () - Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz (8 Threads)

Issue description

When using any kind of standard 2D platformer movement(something with gravity, left-right movement and maybe a jump, although the latter is not necessary) on a CharacterBody2D, going up against a wall from a slope like this:
image(in this case it's the left wall)
causes the character to jiggle.

This problem has been in the engine at least since Godot 3, and I've never seen a malleable solution that doesn't require a wall of code.

Steps to reproduce

1 - create a scene with a 45 degree slope that goes right up against a wall in a StaticBody2D, like the left wall in this image:
image
2 - create a CharacterBody2D with the "Basic Movement" template, or create another script of your liking that has at least gravity and left-right movement;
3 - either make the collisions visible on debug or add a Sprite2D to the CharacterBody2D, so you can see the jiggle;
4 - debug, and move the character up against the wall up the slope, to see the small jiggles;

Also, for a suggestion: to see it better, make the window size something small and put ot on full screen with the viewport mode, because on a larger scale, it's practically invisible.

Minimal reproduction project

min reproduction.zip

@Calinou
Copy link
Member

Calinou commented Jul 13, 2023

This is a problem I encountered in the Platformer 2D demo in godotengine/godot-demo-projects#922. I resolved it by adding a small additional ledge with a different angle to the collision shape (basically smoothing out the collision shape's form).

@lucuinhas
Copy link
Author

i didn't really understand your solution, could you add a photo so i can use it while it's not patched?

@Calinou
Copy link
Member

Calinou commented Jul 13, 2023

i didn't really understand your solution, could you add a photo so i can use it while it's not patched?

Actually, I checked again and I didn't adjust the collision shape, so it exhibits the issue you mentioned here. The collision shape doesn't visibly bob up and down, but the sprite's animation keeps changing endlessly.

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

No branches or pull requests

2 participants