KinematicBody2D fidgets against obstacles?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By 9BitStrider
:warning: Old Version Published before Godot 3 was released.
	if is_colliding():
	var normal = get_collision_normal()
	var final_move = normal.slide(move_remainder)
	speed = normal.slide(speed)
	move(final_move)
	
	if normal == Vector2(0, -1):
		jump_count = 0

Is there a way to stabilize a sprite as it collides with obstacles? I can move the sprite just fine on the play field, but when it bumps up against walls or floors it either tends to bounce at random or fidget back and forth.

I’m using a tileset for the obstacles in 8x8 pieces. Could that be a problem?

:bust_in_silhouette: Reply From: eons

Check the collision margin property on the Kinematic Body, it may be too high if elements and speeds are small and will produce that “bounce” effect during collision.

Also, if using 2.1.3+, turn on the motion_fix_enabled option on the Project settings>2D Physics because it solves some “sliding” issues.

This seems to help for now. I’ll let you know if it causes trouble again. Thank you.

9BitStrider | 2017-08-08 15:09