Hi good and wise people. Please, help the beginer. I can't figure out how to stop object after AddForce. My script is
var Cube : GameObject;
var Sphere : GameObject;
function Start(){
Cube = GameObject.Find("Cube");
Sphere = GameObject.Find("Sphere");
}
function OnTriggerStay (other : Collider) {
if(other.transform.name == "Sphere"){
Sphere.rigidbody.AddForce (1, 0, 0);
}
}
function OnTriggerExit (other : Collider) {
if(other.transform.name == "Sphere"){
Sphere.rigidbody.AddForce (0, 0, 0);
}
}
where Cube is a trigger. Sphere exits the Cube and still moves. I there any way to remove the AddForce? Thanks :)