Crouching and changing collision shape

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

Hello, I’m making a little platformer to see what I’m able to do with Godot. I made my character moving ,animations, wall jump and now I wanted to make him crouch. The thing is I’m not able change the collision shape when the character is crouching. I tried to change the extents but it is centenred so my character is falling into the ground. I changed my sprite to match the extents but this solution is really not viable and it cause somme lag. Can someone help me :frowning:
This is a video showing how the crouching is for the moment

:bust_in_silhouette: Reply From: Dlean Jeans

Change the scale.y of the CollisionShape2D instead.

This works even with many characters. Changing theextents of one character will change the shape of all others since they all share the same shape

:bust_in_silhouette: Reply From: NachoCheese989

You can just make 2 collision shapes; one for when you’re crouching and the other for when you’re not, then just disable the non crouching one when you’re crouching