How does collision influence the movement of KinematicBody when velocity is 0?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By bitrp
:warning: Old Version Published before Godot 3 was released.

For example, I have a bar and a ball on top of the bar. Both are KinematicBody2D.

the bar’s code:

func _fixed_process(delta):
    move(Vector2(0, 0) * delta)

the ball’s code:

func _fixed_process(delta):
    move(Vector2(0, 100) * delta)

Then the bar will be “pushed down” by the ball. Is this the expected behavior of KinematicBody? How to properly move the bar without effected by the ball? I know set_pos() is an option, but this way the bar cannot use its collision detection functions.

:bust_in_silhouette: Reply From: rredesigns

Because by default KinematicBody2D can collide with other KB2D. You can uncheck that option, but that’s probably not what you want.

For the time being all I can say is, you shouldn’t use move() for objects that are not supposed to be moved.

:bust_in_silhouette: Reply From: eons

move is more like an overlap prevention method than a collision detection one, this may help you https://forum.godotengine.org/11812/can-kinematicbody-move-not-block-on?show=11833#a11833