[C#] How to flip character with colliders?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Cristian

Hi.
I’ve tried making:

if (velocity.x > 0) { Scale = new Vector2(1, 1); } else if (velocity.x < 0) { Scale = new Vector2(-1, 1); }

I can flip the sprite, but I need also the colliders.

Do you need to flip the collider? Ideally, this would be visual - the collider should still fit the sprite when facing in either direction. Alternatively, move the collider to its correct location (or have multiple and enable/disable when appropriate).

spaceyjase | 2021-12-28 12:36