UE4 Documentation wrong? (MovementComponent) [SOLVED]

Problem

I have created a pawn wich is controlled by a custom player controller. At the moment I move the pawn like this:

FVector NewLocation = GetActorLocation();
NewLocation += GetActorForwardVector() * (SpeedLvL * Speed) * DeltaTime;
SetActorLocation(NewLocation);

This part is exectuted every Tick. But when I move my pawn like this it obviously “ignors” collision.

So I’ve implemeted a PawnMovementComponent by following this documentation (Step 2 & 3):

In the documenation the Input is passed to the MovementComponent like this:

void ACollidingPawn::MoveForward(float AxisValue)
    {
        if (OurMovementComponent && (OurMovementComponent->UpdatedComponent == RootComponent))
        {
            OurMovementComponent->AddInputVector(GetActorForwardVector() * AxisValue);
        }
    }

After I’ve followed this steps and wanted to test my code the if statement doesn’t become true. Splitting it into:

void ACollidingPawn::MoveForward(float AxisValue)
	{
		if (OurMovementComponent)
		{
			GEngine->AddOnScreenDebugMessage(0, 5.f, FColor::Yellow, "Step 1 done");

			if (OurMovementComponent->UpdatedComponent == RootComponent)
			{
				GEngine->AddOnScreenDebugMessage(0, 5.f, FColor::Yellow, "Step 2 done");

				OurMovementComponent->AddInputVector(GetActorForwardVector() * AxisValue);
			}			
		}
	}

Showed me that the second if (OurMovementComponent->UpdatedComponent) is not == the RootComponet, so this part fails.
I initialize the OurMovementComponent in the constructor like this:

OurMovementComponent = CreateDefaultSubobject<UCollidingPawnMovementComponent>(TEXT("CustomMovementComponent"));
	OurMovementComponent->UpdatedComponent = RootComponent;

When you have any idea what I am doing wrong or what is wrong with documentaion tell me. :slight_smile:

PS: Sorry for the Clickbait :smiley:

Oh and by the way my RootComponent looks like this:

 CollisionSphere = CreateDefaultSubobject<USphereComponent>(TEXT("Collision Sphere"));
    RootComponent = CollisionSphere;

I have also tried the second if statement like this to check if there is something initialized in UpdatedComponent

if (OurMovementComponent->UpdatedComponent->GetName() == "Collision Sphere")

This test was true. So I think there must be something assigned to UpdatedComponent.

I found the problem by my selfe. When you read this thread and have the same problem contact me I help you.

Hi, i’m following that tutorial as well, and currently stucked with my problem: My problem
Also, i checked, if i had the same as you, and yes, that statement isnt true for some reason if (OurMovementComponent->UpdatedComponent == RootComponent)
I hope your solution could help me deal with my own. Could u pls check my problem and maybe share some thoughts, if u allready went through it, or, at least, to say what helped you in your own’s. Thank you.

Please post your solution here so that those who run into these issues can find the solution quickly. You may not always be contactable or able to help.