Just like the magnet,when the two objects collision at the moment,and now i just can’t image how to code.If anybody had encounterd the problem,please give me a hand.Thanks, anyway

You could child the object for a quick effect.

//This will child the collision object and position it 1 unit under the transform
function OnCollisionEnter (collision : Collision) {
    collision.transform.parent = transform;
    collision.rigidbody.isKinematic = true;
    collision.transform.localPosition = Vector3(0,-1,0);
}