RealDocs

UCharacterMovementComponent::UnCrouch

function Engine Since 4.0
#include "GameFramework/CharacterMovementComponent.h"
Access: public Specifiers: virtual

Description

Checks that the default (standing) capsule size fits without encroachment and, if so, restores the capsule and calls CharacterOwner->OnEndCrouch(). Does nothing if the character can't fit while standing.

Caveats & Gotchas

  • For gameplay code, call ACharacter::UnCrouch() instead — it manages bIsCrouched/bWantsToCrouch and replication; calling this directly on the server bypasses that state.
  • If standing up would encroach on overhead geometry (e.g. a low ceiling), the character silently stays crouched — there is no automatic 'partial stand' or notification of the blocked attempt.
  • Common source of bugs: forgetting to re-check CanCrouchInCurrentState()/encroachment after moving the character, which can leave bWantsToCrouch and the actual capsule height out of sync.

Signature

virtual void UnCrouch(bool bClientSimulation = false)

Parameters

Name Type Description Default
bClientSimulation bool True when this call is reacting to bIsCrouched being replicated to a non-owning client, rather than an authoritative uncrouch request. false

Return Type

void

Example

Preferred entry point via ACharacter C++
// Prefer this over calling UCharacterMovementComponent::UnCrouch directly:
ACharacter* MyCharacter = GetCharacterOwner();
if (MyCharacter && MyCharacter->bIsCrouched)
{
	MyCharacter->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.