Player's collider stuck with wall collider when move button pressed even not grounded..

I want the player to fall down as it is not grounded on the platform; however it sticks on the wall. Player sticks on every wall with collider in the scene until left arrow is released. I even tried to add frictionless physic2D material to walls and player but it didn’t work. Can anyone help me with this issue?

 function update(){

        grounded = Physics2D.Linecast(_transform.position, groundCheck.position, 1 <<         LayerMask.NameToLayer("Platform")); 

	RaycastHit2D hit = Physics2D.Raycast(_transform.position, Vector2.right, 10 ,1 << 8);

	if (hit.collider != null && !grounded) { 
		lockControls = true;
	} else {
		lockControls = false;

    if (!lockControls) {	
		move = Input.GetAxis ("Horizontal");

           Vector2 _currentPos = _transform.position;
          _currentPos.x += (move * speed);
	      _transform.position = _currentPos;
                   //  and jump code goes here.....

      } else {
		_rigidbody2D.velocity =;


Try moving the player by adding force to the rigid body. It would look something like this:

        if (Input.GetKey(KeyCode.RightArrow))
            rigidBody.AddForce(transform.right * speed);

        rigidBody.velocity = Vector3.ClampMagnitude(rb.velocity, maxSpeed);

This method has always worked the best for me when moving characters. This is in c#, JavaScript should be very similar though.