Detect Collision between 2 objects


I have two moving cubes with attached box collider and rigidbody. I want to detect the collider when they touch each other and run a script to stop moving.

Any help would be highly appreciated.

function OnCollisionEnter (collision : Collision) {

Make it more complex if necessary. I assume you need to check to see if the cubes are what collided, but you haven't specified.