Collision madness how to fix shaking

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

Hi!
When i make 2 objeckts (kinematic 2D) and make both ability to move and move them one agains the other they keep shaking and often bursts away or glitch inside walls, how can you fix it?
p.s. i put code in _fixed_process(delta) and code has

motion = motion.normalized()*walk_speed*delta
motion = move(motion)
:bust_in_silhouette: Reply From: avencherus

As I understand it, this isn’t a problem, but a limitation to the nature of what a kinematic body is designed to do. They have their uses, like moving platforms and sometimes the main character when you want them to be unresponsive to certain physics.

They won’t do a very good job of pushing against each other.

Since they are “kinematic”, meaning they’re motion based, and are not concerned so much with physical forces, and for that reason you can easily drive them into otherwise impossible situations. The engine just has to deal with it as best as it can, which can result in undesirable visual or spatial results.

It’s best to design around them, or consider using something like rigid bodies where you want things to have mutual collision response.

You can get the collider too (with get_collider, if is_colliding of course), and make the other react or trigger something to avoid undesirable moves.

eons | 2016-11-09 14:36