I’m using UE4.27.2 and the character crouch function doesn’t work if the character is spawned in. If he is placed before launching, everything is fine. I don’t know if it’s a bug or a mistake on my end. Here is the code to test for youtself
Hello @redendermansk1 ,
To make the character crouch, you first need to create an Input Action associated with the key you want to use. To do this, go to Project Settings - Input and, under Action Mappings, click the + button to create a new action and assign your desired key.
Once configured, open your Character Blueprint and find the InputAction Crouch event. Connect the Pressed pin to the Crouch node and the Released pin to the UnCrouch node.
To verify that everything is working correctly, select the Capsule Component and disable the Hidden in Game option. This will allow you to see the capsule during gameplay and confirm that its height is reduced when the crouch key is pressed and restored when the key is released.
If the behavior is what you expect, the next step is to add the appropriate animations so the character visually crouches instead of only changing the size of the collision capsule.
I’ll leave you this video that shows how to set up the crouching animation.
You can also check out this post where I explain how to set it up in Unreal Engine 5. The same post also includes a link to the animation assets available on Fab
Thanks for the guide but this isn’t a playable character just an NPC. I have found the solution. In Character → Pawn I needed to switch Auto Possess AI from “Placed in the world” to “Placed in the world or spawned”. Sorry you had to type out this guide but once again thanks for wanting to help me