How to handle collision shape with different frame size of animated sprite?

Godot Version

<4.2>

Question

<How does major platformer or metroidvania games handle collision shape size for each different frame size of animated sprites?? For example, my animated sprite for jump is smaller than idle and fall. So I switches collision shape 2d with different size through animation player. The problem I am facing is, player is sometimes pushed off the wall and floor instantly when the collision size changes. >

Normally you would have just one static collision shape for the purpose of player<->world collisions. There are cases where it makes sense to change this collision shape (e.g. Samus entering/leaving ball mode), but they are the exception. If you want your hit detection to be more accurate, use a separate Area2D/CollisionShape2D for just hit detection and animate that.