object goes through object

how can i stop the object going through the other object... i have a script that makes my object move around but it still goes through object...what should i do now so i dont make the ojbect go through the other objects... here is the script...

var speed : float = 5;
var turnSpeed : float = 10;

function Update ()
    transform.Translate(Vector3.forward * speed * Time.deltaTime);

    if (Input.GetKey(KeyCode.A))
        transform.Rotate(0, -turnSpeed * Time.deltaTime, 0);

    if (Input.GetKey(KeyCode.D))
        transform.Rotate(0, turnSpeed * Time.deltaTime, 0);

If you're moving a character maybe you'll find useful to use a Character controller. First you have to attach a Character Controller to your character, then you can use "Move" to move the character around.


Anyway through this component's method you can only move the character. To rotate the character you will use the transform of the GameObject. Here you will find more about it.

I hope this will be your solution =)