Porting to Unreal 5.4 problem

Posted by admin on November 27, 2024

Only High now moved to Unreal 5.4, and although it looked normal, something was odd. They changed the behavior of the character movement component.

Before, if your character jumped while standing on a moving platform, it could have the platform velocity and stay on the platform. But now, the character does not inherit velocity when jumping off of a moving platform. Now if you jump you stay in the place and the platform will go without you.

This is bad for Only High, there are many elements when you need to jump over obstacles right a moving project.

So how to fix it, if we look closely at the Character Movement Component, you can check this:

UE5.4 Stay Based in air

It will help to stay on the platform. But if you want to jump off the platform and keep that boost, many shortcuts in Only High are designed that way, then you need to look into C++.

You should have your own Character Movement Component, parent class UCharacterMovementComponent. You need to override a function UpdateBasedMovement.

First, look at the function in the parent class, the last part of the code is what we need to remove. So in your movement component h file add:

virtual void UpdateBasedMovement(float DeltaSeconds) override;

In the CPP file, you might need to add:

#include "Components/CapsuleComponent.h"

Add the UpdateBasedMovement function, copy code from the parent class, paste it here, and remove or comment out the last part. The part looks like this:

// Check if falling above current base
	if (IsFalling() && bStayBasedInAir)
	{
		const FVector PawnLocation = UpdatedComponent->GetComponentLocation();
		FFindFloorResult OutFloorResult;
		ComputeFloorDist(PawnLocation, StayBasedInAirHeight, StayBasedInAirHeight, OutFloorResult, CharacterOwner->GetCapsuleComponent()->GetScaledCapsuleRadius(), NULL);

		UPrimitiveComponent* HitComponent = OutFloorResult.HitResult.Component.Get();
		if (!HitComponent || HitComponent->GetAttachmentRoot() != MovementBase->GetAttachmentRoot())
		{
			// New or no base under the character
			ApplyImpartedMovementBaseVelocity();
			SetBase(NULL);
			return;
		}
	}

You might need to recompile the whole project after, even plugins. I had an "Unknown Error", when I recompiled everything it was gone.


Categories: Only High Unreal Engine Tags: game-dev · unreal-engine · only-high · indie · ue5.4
Login to post a comment.