# I have a problem rotating a 2D game object after collision

I'm developing a simple flip game where a cube flips and the bar a it collides with should start rotating after collision. Most snips involve destroying an object, but that's not my case.

Here is my code:

using UnityEngine;

public class CheckI : MonoBehaviour
{
float x;
public Rigidbody2D rb2d;

void OnCollisionEnter2D(Collision2D col)
{
if (col.gameObject.tag == "bar")
{
x += Time.deltaTime * -10;
transform.rotation = Quaternion.Euler(0, 0, x);
}
}
}


How do I start rotation after collision?

OnCollisionEnter2D is only called once, when the collider first makes contact with the object.
Time.deltaTime is the time that it took to complete the last frame, in seconds. This is almost always a very small number, so you're probably not noticing a very large change. You'll have to multiply this by a relatively large number if you want your change to be instantaneous.
If you want it to happen over time, you can use OnCollisionEnter2D to change a bool, and then apply your rotation in the Update method if bool == true.