Player can pass through walls just a little and then gets pushed back

I have my player character with a rigidbody and a collider. I can stand on the floor without a problem, but when I move towards a wall the player is teleporting back and forth. Also when I jump and walk towards a wall I can stand in the air for a little while, which is also causing me a problem when I try to jump when walking towards a wall, because I don’t just slide past it, but instead get stuck on it and I have to be careful when I jump on the platforms, because if I touch the side of the platform I start glitching. Here’s a video of what I am talking about

private void Update()
        float translation = Input.GetAxis("Vertical") * speed;
        float straffe = Input.GetAxis("Horizontal") * speed;
        translation *= Time.deltaTime;
        straffe *= Time.deltaTime;
        transform.Translate(straffe, 0, translation);


You’re teleporting the player inside the wall. intead of setting the position, use the velocity of your rigidbody. it will move your object and take care of collisions

you need to use rigidbody.AddForce(velocityChange,ForceMode.VelocityChange); here are good scripts from unity community ( ) ( ) ( ) ( ) these will teach you how to use physics controller.