0 votes

Hi there, I'm working on a game (built on top of of one of the isometric samples in Godot) and I'm making slow and steady progress.

However, I'm encountering an issue where everything jitters when the player (KinematicBody2D) collides with certain corners in my tilemap. Specifically, if my character walks straight up into a corner above him, the jittering occurs. Same thing if he walks straight down into a corner below.

It doesn't happen if the player moves left or right into corners. Here's a video showing what happens: https://imgur.com/a/Bm9muIi

I'm calling the moveandslide function inside of the physicsprocess function of the player KinematicBody2D object. Anyone have any idea of what's going on and what I might be able to do to fix this?


Godot version 3.4
in Engine by (23 points)

Could you show the relevant code in your process function please?


This is my code:

var motion = Vector2()

motion.x = Input.get_action_strength("move_right") - Input.get_action_strength("move_left")

motion.y = Input.get_action_strength("move_down") - Input.get_action_strength("move_up")

motion.y /= 2

motion = motion.normalized() * MOTION_SPEED

move_and_slide(motion, Vector2.UP, false, 4, PI/4, false)

1 Answer

0 votes

Hmm... That doesn't help. Those vectors are definitely fine. Yeah, code is fine. Not sure why you changed infinite_inertia to false but it shouldn't make a difference. I guess that was during debuging.

Ok, go to the debug menu and choose "visible collision shapes" - this will let you see the collision shapes in runtime, in case there's a weird protrusion of something. Check for overlapping. Iso isn't x to y symmetrical, there's twice the angle up than there is across.

Try printing the collisions (with get_slide_count() and get_slide_collision()). Maybe they have weird normals or something.

Make sure that the walls aren't colliding with themselves. Check the mask/layers.

If the collision shape is a box, try it with a circle and see.

You can tweek collision settings but I'm reluctant to tell you to do that, the default is generally fine.

Oh! Check the camera. Make sure that isn't the cause / no snapping / no limits / no floor / round / etc.

Sorry I wasn't more help buddy, I'm genuinely not sure.

by (1,789 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.