Rigidbody Sticks to Walls

Hi, I’ve searched around for a answer but can’t find one.
Anyway, my rigidbody works fine except when it touches a wall when I jump and I hold
forward it sticks the the wall. Anyone able to fix this?

using UnityEngine;
using System.Collections;

public class RigidController : MonoBehaviour {
	public float walkSpeed = 10;
	public float runSpeed = 20;
	public float jumpForce = 200;
	public float SpeedLimit = 50;
	public bool isGrounded = false;
	public bool inFront = false;
	public LayerMask rayMask;
	public float groundedCheckDist = 1;
	public float moveCheckDist = 1;
	private float Speed = 10;

	void FixedUpdate () {
		inFront = Physics.Raycast (transform.position, transform.forward, moveCheckDist, rayMask);
		isGrounded = Physics.Raycast (transform.position, -transform.up, groundedCheckDist, rayMask);
		Speed = Input.GetButton("Run") ? runSpeed : walkSpeed;
		transform.rotation = Quaternion.Euler(Vector3.up * Camera.main.transform.localEulerAngles.y);

		rigidbody.velocity = transform.TransformDirection(new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")).normalized) * Speed + Vector3.up * ((Input.GetButtonDown ("Jump") && isGrounded) ? jumpForce : rigidbody.velocity.y);
		rigidbody.velocity = Mathf.Clamp(rigidbody.velocity.magnitude, 0 , SpeedLimit) * rigidbody.velocity.normalized;

If you look at the potato project that Unity provided for 4.3, you need to create a Physics2D material or Physics3D material, depending on your project. To create one, just right click in Project window of Unity and select Create → Physics2D Material and then you can modify the material’s value such as friction. The value 0 works well but 1 seems to work as well, just toy with the value to see what works well for your char.

Then on the collider objects like your wall, make sure the material is using the new physics material you created, and your char won’t get stuck on the walls anymore.

The best solution I’ve been able to come up with is add multiple colliders on your unit, one which act as the feet and one slightly above the feet and slightly wider. The feet collider will have normal friction while the wider one would have no friction. This ensures you won’t stick to walls as the slippery material will always touch the walls first, but also provide you with the proper ground friction to need to not slide everywhere.

On top of the other answer, also make sure your “Friction Combine” isn’t set to Maximum or Multiply on either the player’s physics material or the wall’s physics material

Simply create Physic Material and set properties to:

"Dynamic Friction = 0"
"Static Friction = 0"
"Bounciness = 0"
"Friction Combine = Minimum"
"Bounce Combine = Average" 
  • Then add your Material to all
    gameobjects of the player. Should be
    working as you intended.

The thread is pretty old but, While I was looking for answers I did not find them here… Soo I’m posting solution for others.