On Collision 2D object continuosly bounce/shake

So I basically have two gameobject with a boxcollider2D attached to it, one is a static wall without rigidbody and the other is let’s say the player that I scripted to move using transform.position.

Apparently the object goes inside the wall’s boxcollider and return to the previous position generating thus that orrible shake i’m trying to fix.

A possible solution would be using ray/linecast and would be fine to solve it that way but is there any other workaround for this problem ?
I read that providing forces to the player instead of moving it with transform would be better and may fix this, but how ? What’s the difference ?

The difference at a high level is the “force” / “physics” method applies a “push” that shoves your object. Think “Angry Birds” or a game of shuffleboard or darts. When you update transform.position it is more like teleporting the object rather than pushing it.

The bounce you see might be the collider and your teleportation fighting it out to find a position for your object if every frame you are attempting to teleport inside one.

It can be a challenge to convert teleportation based movement into force based movement and have something that “feels right”.

One thing you can try that is easier than application of force and is much closer to updating your position is to set the velocity vector on your object rather than the position.

In my case, one of the two colliders had a high bounciness material. Removing the material fixed the issue for me.