wired problem with move and slide

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By gruen

Hi Guys,

i have a wired problem with move and slide. i created a video where you see it:

thats my kinematik code:

extends KinematicBody2D

const ACCELERATION = 1000;
const MAX_SPEED = 300

const FRICTION = 1300
var velocity = Vector2.ZERO

func _physics_process(delta):
	var input_vector = Vector2.ZERO
	input_vector.x = Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left")
	input_vector.y = Input.get_action_strength("ui_down") - Input.get_action_strength("ui_up")
	input_vector = input_vector.normalized()

if not input_vector == Vector2.ZERO:
	velocity = input_vector * MAX_SPEED 
	velocity = Vector2.ZERO
velocity = move_and_slide(velocity)

I dont know how to solve that issue

looks ok, and works on my pc. maybe the problem is somewhere else?

whiteshampoo | 2021-02-11 10:18

Hi thank you for your answer.
well thats the only script in my project so far. and i have only the problem with the capsuleShape2d

gruen | 2021-02-11 10:34

is the scale of all nodes (1.0, 1.0)?
i tried to replicate your scene and have absolutly no problem.

whiteshampoo | 2021-02-11 10:41

you are genius.
the collisionshape was scaled instead of changed width and height.

when i resetted the scale, everything works as supposed :slight_smile:

thank you very much :slight_smile:

gruen | 2021-02-11 11:22

Kein ding :wink:

whiteshampoo | 2021-02-11 15:20