Patrolling Enemies

When I first started to plan my game out I wanted some easy enemies that patrolled like the red koopas from super mario bros. But I never really found that much information about patrolling enemies, so I just skipped that step and continued. Now I need to figure out how to make this type of Enemy. What I have right now is when an enemy collides with this invisible cube (point B) then it moves back to point A. There are two problems with this: 1) There is a invisible cube that the player could accidentally hit and get stuck. 2) When the enemy collides with the invisible cube it rotates even though I turned off the rotation in the rigidbody preferences. Is there a way to use empty game objects?

Here is the code I was talking about:

#pragma strict

@script RequireComponent (Rigidbody)

private var myTransform : Transform;
private var myRigidbody : Rigidbody;
var target : Transform;
var target2 : Transform;
// or vector3
var moveSpeed : float = 6.0;

function Start () {
	myTransform = transform;
	myRigidbody = rigidbody;
	
	myRigidbody.freezeRotation = true;
}

function Update () {
	//Moving();

}

function OnCollisionEnter (myCollision : Collision) {
 if(myCollision.gameObject.name == "wall"){
 Moving();
} else
 if(myCollision.gameObject.name == "badCubeB"){
 Moving2(); 
}
}
function Moving () {
	//Ro
	var lookDirection : Vector3 = target.position - myTransform.position;
	var lookRot : Quaternion = Quaternion.LookRotation( lookDirection );
	myTransform.rotation = lookRot;

	//myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;  //basic movement
}

function Moving2 () {
	//Ro
	var lookDirection : Vector3 = target2.position - myTransform.position;
	var lookRot : Quaternion = Quaternion.LookRotation( lookDirection );
	myTransform.rotation = lookRot;

	//myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;  //basic movement
}


function FixedUpdate () {

	myRigidbody.AddForce ( myTransform.forward * moveSpeed);

}

You should use triggers for that!

When I tried it out it flew of the edge. Would this be right:

function OnTriggerEnter (myTrigger : Collider) {
        if(myTrigger.gameObject.name == "badCubeB"){
        Moving2();
    }

Would this go on my enemy or the badCubB which is the invisible wall?