How can I make my character jump from a crouch?

Hello, Friends!

I actually have two questions revolving around my crouch action… I can create separate questions if needed.

Background: I am using the Blueprint First Person template and have successfully created the crouch/uncrouch action. Right now it is very basic. InputAction"Crouch" pressed goes to function: crouched and InputAction"Crouch" released goes to function: uncrouch…in the defaults “can crouch” is true. Testing this allows me to crouch while stationary and also while walking.

The problem comes when I try to jump while in the crouch position; stationary or moving.

I realize that you technically cannot (in real life) jump from a crouched position because in order to jump your legs must be extended.

So the way I see this working is to have the character return to standing height and then perform the jump action. Would this be the best practice? or should I add another action for crouch jump to use both left shift + spacebar?
kinda lost on where to go…

and my second question is there an easy way to slow down the position change from standing to crouched?

Thanks a googol!

MM

Hello MdMoberly.

Firstly: The method that would make sense the most would be to return the character to standing by using - Function UnCrouch and then call - Function Jump

Secondly: There is no built in way to smoothly transition the character from standing to crouching nor vice versa. You can however create your own ‘custom’ crouching, in which you, when - Input Crouch you use a timeline to both smoothly change the player’s collider to a smaller size, and to move the camera downwards so that it is still within the collider. Then you change the walk speed to a smaller one, or multiply it by the in built crouch speed multiplier value.
When uncrouching, you just play the timeline in reverse to change the camera’s position and the collider size, and then multiply the player’s walk speed by 1 / crouch speed multiplier if you used that, or else just set it to whatever speed you want.

Hope this helps :slight_smile:

1 Like

same,and did you make it successfully? please tell me

To uncrouch and jump causes ugly delays, client side in multiplayer games sees this awfully.
This worked for me, override the canJump with your custom logic, then you can just Jump when crouch was set.

On my code, if CanJump(base) says true, then continue, if it’s false then just apply the logic to understand if it’s because it’s crouched. To prevent undesired jumping scenarios, add any other custom logic that should not jump while crouched (Like if you crouch in the air, on my example here)

3 Likes