# Character is not crouching C++

**URL:** <https://forums.unrealengine.com/t/character-is-not-crouching-c/443435>\
**Category:** Character & Animation\
**Tags:** unreal-engine, crouching, CPP, question\
**Created:** [February 15, 2019, 3:43am UTC](https://forums.unrealengine.com/t/character-is-not-crouching-c/443435 "2019-02-15T03:43:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Filtiarn00](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Filtiarn00](https://forums.unrealengine.com/u/Filtiarn00)\
**Post date:** [February 15, 2019, 3:43am UTC](https://forums.unrealengine.com/t/character-is-not-crouching-c/443435/1 "2019-02-15T03:43:37Z")

</div>

I’m not sure why my character is not able to crouch. I set up everything correctly(I think). I new to unreal and I know this is a noob question but I’m confused. It prints out Hit so I know i’m calling the function correctly.

```
void AHumanoidCharacter::ToggleCrouch()
{
	GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, TEXT("Hit"));  
	GetCharacterMovement()->IsCrouching() ? GetCharacterMovement()->UnCrouch() : GetCharacterMovement()->Crouch();
}

//Here is my binding action
PlayerInputComponent->BindAction("Crouch",IE_Pressed,this,&AHumanoidCharacter::ToggleCrouch);

```

![268674-screen-shot-2019-02-14-at-93926-pm.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/0/2/202d65d608d179cc2e3fb8fb8633da874276856a.png)

---

<div class="post-metadata">

**Author:** ![Filtiarn00](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Filtiarn00](https://forums.unrealengine.com/u/Filtiarn00)\
**Post date:** [February 15, 2019, 4:10am UTC](https://forums.unrealengine.com/t/character-is-not-crouching-c/443435/2 "2019-02-15T04:10:40Z")

</div>

Ok I got it to work. I just called ACharacter’s Crouch instead of CharacterMovementControllers Crouch.

```
GetCharacterMovement()->IsCrouching() ? UnCrouch(true) : Crouch(true);
```
