Hello! I am making a 2D platformer and I ran into this problem where the player character will clip into a wall whenever the player holds down a movement key in front of a wall.
I have tried putting the movement code in the fixed update function along with making collision continuous, however doing this only helped a little bit.
Is there a way to fix this?
my movement code:
void FixedUpdate(){
// horizontal movement
if(canMoveHor){
float horMovement = Input.GetAxis("Horizontal");
transform.position += new Vector3(horMovement * speed * Time.deltaTime, 0, 0);
}
}