Well, when collision is made, rotation should not be changed. If I disable rotation everything works fine
https://docs.coronalabs.com/guide/physics/collisionDetection/index.html
Currently, the Box2D physics engine is liable to crash during a collision if Corona code attempts to modify objects still involved in the collision. This is because Box2D is still working out the iterated mathematics on these objects. However, your collision handler may set a flag or include a time delay via timer.performWithDelay() so that the action can occur in the next application cycle or later.
Complete removal of object(s) via display.remove() or object:removeSelf() can be executed during the same collision event time step, but the following APIs and methods can not be called during a collision event:
I will explain what I meant when said buggy
Collision between player and wall[1]
-If collision angle is 90, player will enter the wall for 1/5 of size
-If collision angle is less than 90, and more than 45, collision will be made 50px in front of wall
-If collision angle is less than 45, collision will go smooth
Thanks for helping