Character capsule: reacting to crouch / swim states

Hi guys

I currently have the issue that the capsule of my char does not react to states in the movement component. For example, when I crouch, I would like to reduce the height of the capsule to correctly reflect collision behaviour. The same goes with swimming, where my animation rotates the skeleton 90 degrees and I would like the capsule / collision to reflect that.

What is the intended way to handle this?


For crouching, the capsule should change mostly automatically. Here is what I did and the capsule changes size:

The swimming part is why I found this so I can’t help you there yet. But it might be similar to how I changed the capsule for prone position:

The problem I have with swimming is that the capsule is usually skewed a bit after getting out of water. Haven’t figured out why or how to fix it though.

You have to creatw a c++ project. Create a class extending character.
Create one extending movement component.
Override the movement component swimming state with similar instructions found in crouch.

And/or you just ignore the capsule altogether by changing its collision response while in a swimming state… but that does potentially break physics, so be careful…

For crouching, there is a system in place, but not for swimming. The way I’ve done it a few times is just to have multiple capsule components and toggle their collision settings to enable/disable the correct one, but that does seem dirty. The answer using the C++ override(s) is no doubt the cleanest solution if that’s something you’re comfortable with.