Problem with collision

I try to make a player who can collide with a wall. It sounds very simple but I encounter a problem.
My player is a box - it has got a rigidbody, box collider and a simple script for moving:

using UnityEngine;

using System.Collections;

public class PlayerController : MonoBehaviour {

public float forwardVel = 12;
public float rotateVel = 120;

public Quaternion targetRotation;
Rigidbody rBody;
float forwardInput, turnInput;

public Quaternion TargetRotation {
    get {
        return targetRotation;

void Start() {
    targetRotation = transform.rotation;
    rBody = (GetComponent<Rigidbody>());
    forwardInput = turnInput = 0;

void GetInput() {
    forwardInput = Input.GetAxis("Vertical");
    turnInput = Input.GetAxis("Horizontal");

void Update() {

void FixedUpdate() {

void Run() {
    rBody.velocity = transform.forward * forwardInput * forwardVel;

void Turn() {
    targetRotation *= Quaternion.AngleAxis(rotateVel * turnInput * Time.deltaTime, Vector3.up);
    transform.rotation = targetRotation;


My walls have also got a rigidoby and a mesh collider but my player can’t collide with them and I don’t know why. I’d be very grateful, if anyone could help me.
Here are two screenshots where you can see my player’s and walls’ components:

It looks like your player’s box collider is set to “IsTrigger” which ignores physical collision and uses a “invisible collision” essentially, which doesnt stop objects… Try setting “IsTrigger” to false on your player - and another thing to note, it looks like your map itself is imported, so check the import settings to see if you have “Generate Colliders” on, cause that may help as well.

or maybe you select different layers to each object and didn’t set them to collide in physics settings. try to check Edit>Project Setting>Physics and look at the ticks under Layer Collision Matrix