I have tried with the code below, but the rotation is null (I suppose that the rotation happens only for a single frame, the one where the gameobject collides).
I don’t know if my supposition is right, however I can not satisfy what I’m try to do. It would be appreciate if someone could help me towards the solution, or maybe even correct my code.
I’m not entirely sure what you are trying to accomplish, but OnTriggerEnter2D() only runs a single time upon entering a trigger collider. To trigger again, the object must first leave the trigger, then enter it again.
To continually rotate while inside a collider, use OnTriggerStay2D(). Also, I don’t think that transform.RotateAround() is necessary in this situation. transform.Rotate() is simpler and should get the job done.
As @Bacon004 said very well, @ftdev do try his suggestion. I have another solution to this. Really not sure if you are leaving the collider “a” to reset and detect collision again. But if you want gameObject to keep rotating once it has enter collision with “a” then do this in your OnTriggerEnter function,
And then outside in your class create a Function which you want to keep repeating and also use a bool or something in it to check if a key is pressed or not. Hope this was helpful.