Can't Get Crouch and Prone to Work

Hi gues, my first ever post. I hope it’s in the right place. I’m busting my ■■■ trying to get a crouch and prone mechanic off the same key (C). I followed a YT tutorial (about the millionth time) and I’m almost there but the player wont go into prone (held key) after I just press it/ In other words, if I hold C he’ll go into prone and if I hold C again he’ll go to standing. If I tap C he’ll toggle crouch / uncrouch. But if I’ve laready tapped C, he will not perform prone after that. He’ll do this weird ‘straght to crouch for a split second then back to prone’ again.

It’s like the timer isn’t resetting or something. Hre’s the blueprint I did, following the YT tutorial. Can you see what I’m doing wrong?

P.S I appreciate that this is 101 stuff for you guys and I’m sorry it’s so basic.. any help you can give me will be massively appreiacted and yes, please speak to me as if I’m dumb! :slight_smile:

Helllo @SamFishersGoggles ,Welcome to the forums!

In the image, it’s hard to see how the Blueprint is set up. The nodes appear very dark, and it’s not possible to see the configured values clearly.

Could you upload a new screenshot? That would make it much easier to review the logic and identify where the problem might be.

Make sure the contents inside the nodes are visible, like in this photo.

Thank you @BRGEzedeRocco, it’s great to be here. I appreciate you replying

Sure thing, sorry about the bad image. I hope this one is better

The functionality I’m trying to get is like 3rd person shooters such as Sniper Elite or Ghost Recon Breakpoint where pressing the crouch input toggles crouch on/off (from both standing or prone) but holding it makes the player go prone, or if they’re already prone, makes them return to standing. I hope that makes sense :slight_smile:

From what I can see, the issue appears to be in your Set Movement State. You’re setting the state to Crouching in both cases. In the second node, you should set it to Standing so the character can properly return to the standing state.

Also, make sure that Can Crouch is enabled in the Character Movement component, otherwise the crouch and uncrouch functionality won’t work correctly.

With those changes, it should work as expected.

Thank you @BRGEzedeRocco I set the 2nd node to Standing but sadly, no change. I also have ‘can crouched’ checked.

It’s really weird. It’ll go to/from prone just fine. And will do crouch/uncrouch just fine. But if I try to go to prone from crouched it just stands up straight away. EDIT: It’s like, if I’ve pressed the crouch key, the hold trigger isn’t available after that - it just functions as a press

And if I’ve been prone and return to crouch, then return to stand, on the next prone attempt it does the quick crouch then immediately stand motion

Sorry this is a real head scratcher. It should work. I’m not sure if there’s anything different in 5.7 that would cause this not to work

I really do appreciate your time and help. I really wanted to be able to run back here and say YES! it worked :slight_smile:

Hello again @SamFishersGoggles ,

First, create two Input Actions: one for tap (IA_CrouchTap) and another for hold (IA_CrouchHold).

Then, add them to your Input Mapping Context (IMC_Default) using the same key for both actions (in this case, the C key). Configure IA_CrouchTap with the Tap trigger and IA_CrouchHold with the Hold trigger.

With this setup, a short key press will trigger the crouch action, while holding the key will trigger prone.

Next, create a custom event called UpdateMeshCapsule. This event is responsible for updating the mesh position whenever the capsule height changes, preventing it from breaking or behaving incorrectly when transitioning between the Standing, Crouching, and Proning states.

After that, create three Custom Events: StartStanding, StartCrouching, and StartProning, using the logic shown in the screenshots. Inside these events, I also manually set the movement speeds, since when switching directly between states (for example, from Standing to Proning), the movement values do not always update automatically.

Finally, connect each Input Action to a Switch on E_States. The Tap event toggles between Standing and Crouching, while the Hold event toggles between Proning and Standing.

With this setup, you should get the behavior you were expecting

Let me know if it works.

@BRGEzedeRocco Thank you so much - it worked!

You’re a legend, sir! :raising_hands:

Out of interest, where do you think the problem is with the previous approach (from the tutorial)?

I like your approach of making 2 separate input actions. And there wasn’t a boolean in sight!

Hi again @BRGEzedeRocco I’ve encountered a different problem with this now… in trying to setup my anim graph, I don’t have an IsProne boolean to refer to for my transitions

In the new bp logic that you’ve given me, where could I connect an IsProne variable so that the anim graph can read it?

I don’t think there’s any issue with the first approach. The main advantage of this approach is that each action has its own dedicated event, which makes the system easier to maintain and more scalable. If you want to add a new action in the future, you only need to create a new Custom Event for that action and add a new state, without having to significantly modify the existing logic. With the first approach, you would probably have to rework part of the logic to adapt it to those changes.

Another advantage is that it makes better use of the Enhanced Input system (Tap/Hold), since each action has its own Input Action and there’s no need to manually handle the logic to distinguish between a short press and a held press.

Regarding the Anim Graph setup, you could create another post specifically about that issue? If I’m unable to resolve it, someone else may be able to help. I don’t have much experience with Anim Graphs, so using a bool might not be the only solution.

Since this topic is already resolved, it’s unlikely that many people will come back to review it. Creating a separate post for the issue would give it more visibility and increase the chances of receiving different suggestions or solutions.