RealDocs

ACharacter::GetJumpMaxHoldTime

function Engine Since 4.8
#include "GameFramework/Character.h"
Access: public Specifiers: virtualENGINE_API

Description

Returns the maximum duration the jump key can be held to continue receiving upward force. By default this returns the JumpMaxHoldTime property; override to make it dynamic.

Caveats & Gotchas

  • If StopJumping() is not called before this time is reached, the character will continue gaining upward velocity. Always call StopJumping() in your jump-release input handler to prevent runaway jump height.
  • The value returned here is read by ClearJumpInput() on every frame while the character is jumping. Returning different values between frames within the same jump can produce inconsistent jump heights on clients and cause network desyncs.

Signature

ENGINE_API virtual float GetJumpMaxHoldTime() const;

Return Type

float

Example

Return a higher hold time when a power-up is active C++
float AMyCharacter::GetJumpMaxHoldTime() const
{
    float BaseTime = Super::GetJumpMaxHoldTime();
    return bHighJumpActive ? BaseTime * 2.0f : BaseTime;
}

Version History

Introduced in: 4.8

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.