Hello, I’m trying to use the new Enhanced Input Action System to crouch. The crouching works, but how do I get a smooth transition between standing and crouching? I’m using a true first-person character.
Thanks
Hello, I’m trying to use the new Enhanced Input Action System to crouch. The crouching works, but how do I get a smooth transition between standing and crouching? I’m using a true first-person character.
Thanks
You can create your own crouch events like this: Note: If you would like to set the isCrouching variable as well, add that at the start of the events before the timeline. The timeline should be for the desired duration of the transition, and the output value should be 0 to 1.
Thank you, this works pretty well. How can I use the ‘Max Walking Speed Crouched’ when crouching? Of course, I could just set the ‘Max Walking Speed’ to 300, but I’d like to use the internal crouch speed.
The short answer: You are limited by blueprints. You can not set bisCrouched manually because it is BlueprintReadOnly, so it’s value will never change unless you call the native crouch function which does this. But that means you get everything else with it like the instant capsule rescaling and no smooth transition. Ideally you would want to rewrite this movement functionality in c++. But, if you are only using blueprints, just make your own speed variables, and set max walk speed accordingly when standing vs crouching. the max walk speed crouched is only used to determine speed value when the IsCrouching() function returns true (bisCrouched = true), which there is nothing you can do about unless you override or expose to BPs in c++. Again, cant override any of these functions or set the boolean, as-is, in blueprints without c++ modification. So realistically there is no advantage to using the “internal” max crouch speed var over one of your own and just ONLY using the max walk speed. To be specific, maxspeed is determined by:
return IsCrouching() ? MaxWalkSpeedCrouched : MaxWalkSpeed;
Hopefully that clears things up. I recommend looking at the source code for the Crouch() function because my example works in the sense of a smooth transition, but it is very simple and lacks checks or other functionality you should include in your new crouch events, such as capsule height scaled and unscaled, capsule adjustment and mesh adjustment, etc.
Thank you for the extensive explanation. I think I’ll stick with the ‘Max Walking Speed’ settings then.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.