Trigger enter issue

I have 2 moving gameobjects with same script attached to it.

In script trigger enter function i written

By touching each other both have to move in different direction.

direction is same in script.

by giving

dirX*= -1;
dirY*= -1; 
direction = transform.TransformDirection(new Vector3(dirX,dirY,0));

both gameobject collide and moving

I have to make one object in another direction

How can i do it

function OnCollisionEnter(other : Collision) {
direction = other.contacts[0].normal;

More examples: