Is there any way to make a custom crouch function?

Hello!

I would like to create a custom crouch function in blueprints mainly to change the size of the capsule component like it does in the crouch function if there is a way that’s possible?

Any help will be appreciated, thank you!

Hey ,

It is totally possible. Here is one way:

Thanks for your answer I’ve just implemented it and it works very well probably better than the standard function. However my game is a third person shooter and when the crouch is enabled the character sinks through the floor for some reason. If you know a way to fix this it world be much appreciated. Also is there a way to make it so it’s event based cos using event tick I think is a bit unnecessary when you might only be crouching for 5 minutes per level. Thank you very much!

I’m actually having the same issue too^ I really want to know how to prevent my character from sinking

For those having the character-sinking issue when implementing the custom crouch, its because the mesh component is attached to the very middle of the capsule, and when you change the capsule height the point the mesh is parented to changes as well. How I solved it was to AddRelativeLocation to the Mesh component with a + offset in Z when crouching, and a - offset when uncrouching. Hypothetically (CapsuleHeight - CrouchCapsuleHeight)/2 would give you the needed offset, but for my test animations at least I needed to boost that offset another 5 units.