RealDocs

ACharacter::OnEndCrouch

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

Description

Called in C++ when the character finishes crouching. Also called on non-owning characters via replication when `bIsCrouched` changes. Override to apply camera or mesh adjustments when the character stands up.

Caveats & Gotchas

  • Always call `Super::OnEndCrouch()` — the base implementation repositions the mesh and capsule. Skipping it will leave the character visually misaligned.
  • This is called on simulated proxies through the `OnRep_IsCrouched` replication notify, so it fires for all clients when the server character stands up. Avoid expensive logic here that should only run on the owner.
  • For Blueprint overrides use `K2_OnEndCrouch` (the `BlueprintImplementableEvent` wrapper); overriding `OnEndCrouch` directly from Blueprint is not supported.

Signature

ENGINE_API virtual void OnEndCrouch(float HalfHeightAdjust, float ScaledHalfHeightAdjust)

Parameters

Name Type Description Default
HalfHeightAdjust float Difference between the default capsule half-height and the crouched capsule half-height.
ScaledHalfHeightAdjust float The half-height difference after the component scale is applied.

Return Type

void

Example

Adjust camera Z on stand-up C++
void AMyCharacter::OnEndCrouch(float HalfHeightAdjust, float ScaledHalfHeightAdjust)
{
	Super::OnEndCrouch(HalfHeightAdjust, ScaledHalfHeightAdjust);

	// Move the spring arm back to standing height
	if (CameraBoom)
	{
		CameraBoom->TargetOffset.Z = 0.f;
	}
}

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.