RealDocs

ACharacter::Crouch

function Engine Blueprint Since 4.0
#include "GameFramework/Character.h"
Access: public Specifiers: virtualBlueprintCallableENGINE_API

Description

Requests the character to start crouching. The actual transition is processed on the next CharacterMovementComponent tick, not immediately.

Caveats & Gotchas

  • This only sets a request flag (WantsToCrouch) on the movement component — the character does not actually crouch until the next movement tick. Do not rely on IsCrouched() returning true immediately after calling Crouch().
  • Crouching requires NavAgentProps.bCanCrouch to be true and sufficient space overhead; if the space check fails the character may not stand back up after uncrouching. Pair with CanCrouch() checks.
  • The bClientSimulation parameter is for internal replication use. Passing true from gameplay code will bypass normal server-side crouching logic.

Signature

ENGINE_API virtual void Crouch(bool bClientSimulation = false);

Parameters

Name Type Description Default
bClientSimulation bool If true, this is being called on a simulated proxy to mirror the crouched state from replication. Should not be set to true in gameplay code. false

Return Type

void

Examples

Crouch on input press, UnCrouch on release Blueprint
InputAction Crouch (Pressed) Crouch Target is Character Target InputAction Crouch (Released) UnCrouch Target is Character Target
Edit Blueprint graph Crouch on input press, UnCrouch on release
Drag node headers to move · Drag from an output pin to an input pin to connect · Scroll to zoom · Right-click for actions
Crouch on input press C++
void AMyCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
	Super::SetupPlayerInputComponent(PlayerInputComponent);
	PlayerInputComponent->BindAction("Crouch", IE_Pressed, this, &AMyCharacter::StartCrouch);
	PlayerInputComponent->BindAction("Crouch", IE_Released, this, &AMyCharacter::EndCrouch);
}

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

void AMyCharacter::EndCrouch()
{
	UnCrouch();
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.