Desired behavior: when AI colliding with a moving rock, turn AI off for a while (dizzy) to follow the physics (bounce).
In OnCollisionEnter2D, I set AIPath.canMove to false. But what I got is the AI just move a little bit, then stops moving. If it been hit by a second rock during the period, the AI starts follow physics to bounce.
I checked AIBase, that it uses rigidbody.MovePosition in FixedUpdate to position the game object. Based on Unity ExecutionOrder, the execution order is FixedUpdate => Internal physics simulation => OnCollisionXXX. Thus during that frame, rigidbody.MovePosition run first, then the physics simulation, then canMove set to false.
I wonder is this desired behavior achievable?
Update: the collided rock is destroyed in OnCollisionEnter2D.