Character.h "crouch" function not working

I have read a couple other post about getting crouch to work. I followed what the others did however it seems the Crouch(); function in Character.h doesn’t do anything. Below are my code snippets.

Thanks!

AShooterCharacter.cpp file

InputComponent->BindAction("Crouch", IE_Pressed, this, &AShooterCharacter::StartCrouch);
InputComponent->BindAction("Crouch", IE_Released, this, &AShooterCharacter::StopCrouch);

void AShooterCharacter::StartCrouch()
{
	Crouch();
}

void AShooterCharacter::StopCrouch()
{
	UnCrouch();
}

AShooterCharacter.h

/** player pressed crouch action */
void StartCrouch();

/** player released crouch action */
void StopCrouch();

Check in movement component if you set can crouch to true

That worked! I was wondering if you knew how to enable that in the C++ code though?

Hi,

in Your “CharacterMovementComponent” 's “Constructor” insert “bCanCrouch = true;”