Get an object to stop when it hits something

So I want to get my “plateoffood” to stop when it collides with the object “block”. I am not sure how to do this. At first I thought I would put a blockade around the object but it would either push against the blockade and eventually move around it or it would continuously shake. Here is my script attached to the object “plateoffood” (Javascript).

#pragma strict

 function Update() {
         // Move the object to the right relative to the camera 1 unit/second.
         transform.Translate(Time.deltaTime, 0, 0, Camera.main.transform);
     }

So how do I get it to stop? I am a beginner at coding and I would appreciate help greatly. Thanks!

Use a bool that tells if the object can keep moving. On collision, set the book to false.

Doesn’t matter I will stick to my original method.