Preventing change in X position when jumping

Hi, i’m making a 2d game demo.My player has rigidbody component.I freezed all of rotations and z position.My problem is if i freeze x position, it causes collision errors on edge of platforms or corner of platforms and player is jittering.On the otherhand if i don’t freeze x position , after the jump when player is on ground, x position of player slightly changing and player looks weird, like shaking, player a little bit getting smaller then getting normal scale .

My question is how can i prevent changing in x position without using freeze position?

Thank You …

You could save the position each frame in a variable. And in update function make a check, if player is jumping players position x = saved position x.