How to stop a moving object

Hello dear Unity forum users, I am a beginner in unity and beginning to understand parts of basic scripting (I graduated in 3d max design animation, so this is completely new to me). Hoping you guys can help me out with this little problem I am having at this point of my game.

Would really appreciate it if you dumbed it down for me, when i look at rays and arrays starts to give me a headache lol.

oK so the game is basically objects falling and user trying to stop them midair when ever they click on them objects gets pushed on “x” excess and stops. so far my code is on enemy

var speed = 1;

function Update () { transform.Translate(0,-speed*Time.deltaTime,0);

if(transform.position.y <= -6){

transform.position.y = 5;
transform.position.z= Random.Range(-2.1,1.9);

} } } function OnMouseDown () { Debug.Log(“clicked you”) }

Please help!!

you could turn of the ‘use gravity’ in the rigidbody

var thisobject = gameObject.GetComponent(Rigidbody);

thisobject.rigidbody.useGravity = false;

Thank you everyone for replying so fast, love you guys.

Thanks Inkspots, for your code, however like i mentioned really new to unity, going through basic tutorials. I ported an object from 3d max, gave it rigid body and a box collider so far. used the script above which is making the object move at a certain speed downwards.

I would like to click the falling object and make it stop on the spot. I tried your code, but i might be using it wrong, where exactly do I input?

Thanks again guys for being so patient, any help is appreciated