[2D] Slide object after collision

Hello community!

I am currently working on a top down 2D game and I got a little problem.

I want to make an object slide AFTER a collision.
So that the player changes the direction (with the “W-A-S-D” keys), but the object which was hit before slides a bit in the previous direction.

Here is my code so far, but it doesn’t work:
(for example, when the player pushed the object to the right):

private void OnCollisionExit(Collision collision) 
{
	collision.transform.Translate (Vector3.right*10);
}

I hope you understand what I want to do and thanks in advance!

EDIT: It is a top down game, so there is no gravity.

EDIT2: I added a few images.

89310-direction-change.jpg

89311-after-change.jpg

Honestly, the best way I see moving this object is through the physics supplied in the engine… make the mass of the Player larger than the box, and when the character moves and collides with the object… the object will slide via being pushed by the character…

No need for to re-invent the wheel heres a previous question that has created a movement script for a top down style game:

This works for 3D games

  1. Go to your player’s rigid body > increase the Drag number
  2. Go to your player’s rigid body > Constraints > Freeze Rotation on XYZ and Freeze Position on Y