I just want to change between character states crouch and prone upon key held input like something from call of duty etc
Your video is just for one input, i’m looking for a solution that implements crouch to prone with key held input
I don’t know about CoD so would you mind expanding on that?
If you want to know how long something is taking, you need an origin, to track the start of the keypress.
From there you would have to somehow periodically check the length of time since the key started being held down, then act appropriately.
For example: you could have it as such your animation-graph blends from standing to crouch and just-assumes you keep going from crouch to prone, then on it’s update-tick, check the state of the key. If the key is no longer being held, stay in the current animation/pose. You might have to add in a bit of a buffer to account for them being mid-transition, but I think you can get it from there.
That’s just one way, you could assume the pose-transitions DO stop, and logic your way from that.
EDIT: I don’t play CoD either so I cannot comment on that system.
you press ctrl to crouch and if you hold ctrl while crouching you go prone, if not you stand back up
this is what I came up with but I still have trouble wrapping my head around how and if the gate works properly as the states are sort of bugged when transitioning as I am still looking for the most effective and proper blueprint/nodes to use to get the desired input right
on press - grab the time you started holding the button
on release - grab the time when it was released
on the animation for crouch, at whatever point you deem to be the critical-point, check the status of the button to see if it’s been held down the whole time. you use the release-time to make sure it’s BEFORE the press-time, because in that use-case you haven’t yet released it from the last time you pressed it; it would still be holding the release from the time-before. if you are still holding it, then transition to the prone animation
there is also enhanced input which can do things like this for us. they can track 3axis of movement (button is 1, stick is 2axis, motion of the controller is 3vec), but also chorded actions with multiple buttons, holding/charging a button for a certain time like we are doing here, etc, etc… I would suggest you also look there.
ref - Enhanced Input in Unreal Engine | Unreal Engine 5.5 Documentation | Epic Developer Community
thanks, ill take a look. is enhanced input only for 5?
yes but it’s also meant to be more platform agnostic so you don’t have to keep reinventing the wheel.
one of those things where you bend to the product, but it ends up saving so much time in the long-run. it’s worth the short term investment.
you basically break your game down to actions (crouch, prone, shoot, rearm, switch weapon, etc) and then can map those to different inputs, per platform, it will also do the icon-thingies for keys when you plug in a controller, etc. very handy on Epic’s part. all the stuff that you are obligated to do for every game, you can use a preset-system for now.
that makes a lot of sense, unfortunately for me i’m a little behind in terms of keeping up with industry standards and conveniences unbeknownst to me lol. But i’ll manage. The challenge is part of the fun i guess. I’ll see if i can update this input action, it’s one of those problems i’ve been stuck on for a some time with little information about enhanced input prior etc.
thanks
I’d make the effort to at least learn some of the newer things in UE5. YES it’s a bit of an investment but the foundation shouldn’t really change so much since it’s so agnostic in terms of hardware/platform, but also recyclable for future projects.
I’ve dug into Lyra and there’s a lot there to build upon. It’s a full game in it’s own right, integrated with Epic Online Services w/multiplayer and multiplatform support; you just have to add to it.
this guy is a good resource: LyraStarterGame Overview | X157 Dev Notes
the first step is to make a custom-plugin, so you can well, plugify your entire project: How to create a new Game Feature Plugin and Experience in Lyra | Tutorial
building on lyra will build on the already-build Ehanced Input, etc; all the newer best practices. once I made a plugin, I migrated the bits from my various projects to the content folder under the plugin directory, a bit of UserExperience config, and we’re off. took me a night to assemble most of it.
would strongly recommend, spend a weekend reading at least to see what it has to offer.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.