Problems while Changing the Collision Capsule Size

Hello,

I’m facing an overlap error, the error happens when I change the size of the capsule, and the new capsule ends across the floor.

Is there any way to prevent this from happening?

Move character too.

When using crouch/uncrouch I make line trace to ground and check it’s length. Then set character local offset to move it by Z axis.

From what you show me, I think there are 2 way to fix this:

+) Play game in editor. Then change capsule size, when your new capsule end across the floor, drag your capsule up until it got into correct position, then you will got the amount of deltaPos you will need to add to the capsule when you change capsule size from small capsule to big one. Add deltaPos to your capsule relative position when you update your capsule size.

+) Before change your capsule size, add a jump force before change your capsule size. With this, you can make sure that your capsule won’t end up below the floor.

Also before allowing the capsule to grow, check ABOVE the character that it has enough room to accommodate the final capsule size by doing a capsule trace up for a distance of 1 in the Z axis. If it is not blocked, then allow it to proceed with the capsule resize. If is is blocked though, keep it shrunk down until there is enough room.