Character movement doubled if attached to moving actor(pawn)?

Hi,
if a character is standing on top of an moving actor, the character gets moved as the actor is moved, wich is absolutely ok. But if i attach the character to this moving actor, the character movement gets doubled. How can i solve this, so that the attached character can freely walk on the moving actor without getting altered by the movement of the actor.

Looking for a solution to a similar problem. I have a blocking volume that moves when the player moves on top of it. When the player moves, it creates a horrible feedback loop, eventually moving the player absurdly fast

Hi,

i found a kind of quick’n’dirty workaround for this problem, it’s caused by the CharacterMovementComponent.

I have created a custom CharacterMovementComponent in c++ and i have overridden the void UpdateBasedMovement(float DeltaSecons) function. This function applies the velocity from the Actor the Character is standing upon to himself. If the character is attached to this actor he gets twice the velocity of the moving Actor.
Take a look at
https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Source/Runtime/Engine/Private/CharacterMovementComponent.cpp

I copied the whole function and just prevented the position update while leaving the rotation stuff as is.

For implementing a CustomMovementComponent see A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums

I also noticed that i have to turn of ImpartBaseMovement for correct jumping results, otherwise the character will be pushed forward while jumping.

Hope this helps :wink:

1 Like

What exactly you change?

It’s an old post, but I’ll complete the answer without copying all the function. You can avoid BaseMovement compensation by handling the case that your Character is attach to an actor like so :

void UMyCharacterMovementComponent::UpdateBasedMovement(float DeltaSeconds) {
	if (CharacterOwner->GetRootComponent() == nullptr || CharacterOwner->GetRootComponent()->GetAttachParent() == nullptr)
	{
		Super::UpdateBasedMovement(DeltaSeconds);
	}
	else
	{
		return;
	}
}

Another advise, I encounter an issue when a Character is attached to another actor, Movement will not replicate from the server to clients (at least not properly) even if you replicate RootComponent and parent actor.

See Unreal Engine Issues and Bug Tracker (UE-53604)

Anyone have a more indepth explanation of this? Would very much appreciate some help!