Rigidbody (Player) goes through wall

I have a game that player is the cube. That cube moves around like 2D side scrolling game. The cube has a rigidbody and box collider to it. When the player moves toward the wall, and touch the wall, a bit later, the player suddenly goes through the wall. I have searched this site for the solution that have written before, but what I found doesn’t match my condition.

Here is my control script (shortcut) :

transform.Translate (Vector3(Input.GetAxis ("Horizontal") * Time.deltaTime *speed,0,0),Space.World);

Here is the link to the game if you want to see the problem more clearly.

http://www.kongregate.com/games/vitou01/cube-land

Thanks in advance.

Edit :

my wall has box collider.

Transform does not call the Physic components of your rigidbody, thus it ignores all physic. Colliders are physic component, for your code to include them you must move your objects using it’s rigidbody physics.

http://unity3d.com/support/documentation/ScriptReference/Rigidbody.html

ie: When I do an AI that need to have perfectly controlled movement, I manage the Velocity of the rigidbody through code.

Depending on what you want to do and your ease with physics, you may want to use the Character Controller, it’s essentially a rigidbody with simplified functions to be controlled as a Character.

http://unity3d.com/support/documentation/ScriptReference/30_search.html?q=character+controller

If you would add the CharacterController component to the cube, you could call it’s Move method. Maybe works better.
http://unity3d.com/support/documentation/ScriptReference/CharacterController.Move.html

I see your camera isn’t really smooth too. (Maybe you could use the methods Slerp/Lerp of Vector3, to make things smoother.)