AI problem/map problem

well I have some problems with the AI not directly but with what it does. it just goes through everything in the map and doesnt ge stopped by anything and i dont know how to fix it. im using a very basic script i got from another post cause i do not know how to script yet. this is the script im using

#pragma strict

var target : Transform; //the enemy's target
var moveSpeed = 3; //move speed
var rotationSpeed = 3; //speed of turning

var myTransform : Transform; //current transform data of this enemy


function Awake()
{
    myTransform = transform; //cache transform data for easy access/preformance
}

function Start()
{
     target = GameObject.FindWithTag("Player").transform; //target the player

}

function Update () {
    //rotate to look at the player
    myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
    Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);

    //move towards the player
    myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
}

and also the map i made was in sketch up and sometimes when the AI goes thru the wall the map starts to move around and spin by itself.
any help on this would be much appreciated :slight_smile:

transform.position ignores any and all physics. If you want to interact with other objects, either write your own collision code, or use RigidBody.AddForce or a similar physics based method. Another working example would be CharacterController.Move.