My code moves my player into walls and objects

My player is glitching through objects. How do i fix it

using UnityEngine;
using System.Collections;

public class Movement : MonoBehaviour {

	public GameObject Character;
	public float Speed = 5f;
	public bool canControl;

	public int jumpHeight = 8;

	private bool isFalling = false;

	void Update()
	{
		if(canControl == true)
		{
			float h = Input.GetAxis("Horizontal") * Speed;
			
			Character.transform.Translate(h*Time.deltaTime,0,0);
		}

		if (Input.GetKeyDown (KeyCode.W) && isFalling == false) {


			GetComponent<Rigidbody>().AddForce(Vector3.up * jumpHeight);
			isFalling = true;

		}

	}

	void OnCollisionStay(){

		isFalling = false;

	}
}

Sorry i wasnt specific remove the rigidbody from your character and only have a character controller ,then do this

public characterController character;
public float speed;
 float h = Input.GetAxis("Horizontal") * Speed;
 character.move(tranform.forward * speed*h); //speed is the speed of movement
character.move(Vector3.down* 10); //Gravity to push the player down

if (Input.GetKeyDown (KeyCode.W) && isFalling == false) {

         character.move (Vector3.up * 10 * JumpHeight);
         isFalling = true;

     }

Not very detailed, but I’m assuming we’re looking at 2D here?

On your Rigidbody2D component, try setting your collision detection mode to “Continuous”.

Also, make sure you have 2D colliders on all objects that you shouldn’t be passing through.

Hope this helps.