Custom Jump Method

Instead of using the built-in jump method, I used ChatGPT to help me create a jump method with a gravity check, and the result was quite good. I would like to share it here as well.
ShooterCharacter.h

	UPROPERTY(EditAnywhere)
	float JumpHeight = 600.f;

ShooterCharacter.cpp

#include "GameFramework/CharacterMovementComponent.h"

void AShooterCharacter::Jump()
{
	if (GetCharacterMovement()->IsMovingOnGround()) {

	LaunchCharacter(FVector(0.0f, 0.0f, JumpHeight), false, false);
	}
}

Privacy & Terms