# UE4 Documentation wrong? (PawnMovementComponent)

**URL:** <https://forums.unrealengine.com/t/ue4-documentation-wrong-pawnmovementcomponent/102228>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [November 5, 2017, 2:23pm UTC](https://forums.unrealengine.com/t/ue4-documentation-wrong-pawnmovementcomponent/102228 "2017-11-05T14:23:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_b27f09681](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b27f09681](https://forums.unrealengine.com/u/anonymous_user_b27f09681)\
**Post date:** [November 5, 2017, 2:23pm UTC](https://forums.unrealengine.com/t/ue4-documentation-wrong-pawnmovementcomponent/102228/1 "2017-11-05T14:23:35Z")

</div>

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

1. FVector NewLocation = GetActorLocation();
2. NewLocation += GetActorForwardVector() \* (SpeedLvL \* Speed) \* DeltaTime;
3. 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):

[https://docs.unrealengine.com/latest/INT/Programming/Tutorials/Components/index.html](https://docs.unrealengine.com/latest/INT/Programming/Tutorials/Components/index.html)

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

1. void ACollidingPawn::MoveForward(float AxisValue)
2. {
3. if (OurMovementComponent && (OurMovementComponent-\>UpdatedComponent == RootComponent))
4. {
5. OurMovementComponent-\>AddInputVector(GetActorForwardVector() \* AxisValue);
6. }
7. }

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

1. void ACollidingPawn::MoveForward(float AxisValue)
2. {if (OurMovementComponent){
3. GEngine-\>AddOnScreenDebugMessage(0, 5.f, FColor::Yellow, “Step 1 done”);
4. if (OurMovementComponent-\>UpdatedComponent == RootComponent)
5. {
6. GEngine-\>AddOnScreenDebugMessage(0, 5.f, FColor::Yellow, “Step 2 done”);
7. OurMovementComponent-\>AddInputVector(GetActorForwardVector() \* AxisValue);
8. }
9. }
10. }

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:

1. OurMovementComponent = CreateDefaultSubobject\<UCollidingPawnMovementComponent\>(TEXT(“CustomMovementComponent”));
2. OurMovementComponent-\>UpdatedComponent = RootComponent;

Oh and by the way my RootComponent looks like this:

1. CollisionSphere = CreateDefaultSubobject\<USphereComponent\>(TEXT(“Collision Sphere”));
2. RootComponent = CollisionSphere;

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

1. if (OurMovementComponent-\>UpdatedComponent-\>GetName() == “Collision Sphere”)

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

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

PS: Sorry for the **Clickbait** 😃
