How to stop an Object from Moving When It Hits Collider

Hi. As the title of my question states, I want to stop an object from moving once it hits a collider using onTriggerStay(not using the built in physics engine). My question is how can i do this if there is no rigid body attached to the object?

If you want to use any collision functions (OnCollision Enter / Stay / Exit or OnTrigger Enter / Stay / Exit) you should attach a rigidbody to the moving object no matter if you use physics or not. If you don’t need physics make it a kinematic rigidbody.

Next thing is, if the object isn’t moved by the physics system (forces / gravity) then you probably move the object in your of your scripts. Well if you don’t want to move the object anymore you have to tell your script to not move the object, or just disable the script.

Considering the fact that you are moving in x direction.
You can do this:

var a : int = 0;
var movingObject : GameObject;
var obstacle : GameObject;
function Update(){
   if(a == 0){
     movingObject.transform.position.x++;
   }
}
function OnCollisionEnter(collision : Collision){
   if(collision.gameObject.tag == "obstacle"){ //tag of the object "obstacle"
      a = 1;
   }
}