Simple Moviment script bug:(

I’m making a game but I’ve got some problems with the moviment,when I use my script to walk the player crosses all the walls:shock:.That’s my code:

/*That script controls the tank moviment*/


var speed=10;
var  rotateSpeed:int=50;
function Update () 
{
transform.Rotate(0, Input.GetAxis("Horizontal") * rotateSpeed * Time.deltaTime, 0);
    var y = 0;
    var z = Input.GetAxis("Vertical") * speed * Time.deltaTime;
    transform.Translate(0 , y, z );
}

Thank you

How is the object represented for collision detection and physics simulation purposes? Is it a character controller? Does it have a rigid body?

Add a CharacterController to the player

Take a look:

No,the player already have a Character Controller

If the object has a character controller attached, try using CharacterController.Move() or .SimpleMove() instead of Transform.Translate().