Floating Pawn Movement Component Affecting Wrong Component

So I am trying to make a pawn that moves using a movement component. I have a very simple setup so far.

in the .h


 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Movement)
         UCapsuleComponent* CapsComp;
 UPROPERTY(VisibleDefaultsOnly, Category = Mesh)
         class USkeletalMeshComponent* Mesh1P;
 
 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Movement)
         UFloatingPawnMovement* MyPawnMoveComp;

in the .cpp


     CapsComp = CreateDefaultSubobject < UCapsuleComponent > (TEXT("TheCapsComp"));
     CapsComp->InitCapsuleSize(42.0f, 96.0f);
     RootComponent = CapsComp;
 
     Mesh1P = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("PlayerSkeleton"));
     Mesh1P->AttachTo(RootComponent);
 
     MyPawnMoveComp = CreateDefaultSubobject<UFloatingPawnMovement>(TEXT("PawnMoveComp"));
     MyPawnMoveComp->UpdatedComponent = CapsComp;

I have the functions for movement that are used in the third person example bounds to inputs (looking like this):


 AddMovementInput(GetActorForwardVector(), Value);

The problem is that the mesh of the pawn will move but not the capsule. The capsule will stay in place, give off line traces, block objects, do every thing it is supposed to. The mesh will move around, it will move through walls and float just like you would expect if the movement component was assigned to it (but it is not).

Any thoughts on what I am doing wrong or why this might be happening?

I took a slightly different approach. I setup everything in the Blueprint Editor because in the end it’s a lot easier to manager and customize later on.

Is there any reason why you are not doing this?

What do you mean by everything? The whole project or part of the movement component?

I have a class that inherits from APawn. Then in the UE4 Editor I create a Blueprint Class based of my APawn derived class. In the Components section of the Blueprint Editor I add the needed components, with the first one being the FloatingPawnMovement component. Then I add my SkeletalMesh (because I have moving parts), along with several subcomponents under it.

In code I spawn my Blueprint Class that was created with my APawn derived class, and seems to work pretty well.

Wouldn’t that mean you would have to put all your gameplay code in the blueprint because it doesn’t have a parent class in c++?

Can you PM me your Skype account, if you have one?

Btw, if you click my name a dropdown will appear with Private Message on it.

So gave me some useful info but it didn’t solve my problem.

I want to use a UFloatingPawnMovement component for my pawn. I also want the root component to be a capsule and the movement component to update that. I know in the character movement component cpp it checks to make sure the updated component is a capsule but for the PawnMovementComponent.cpp it is only checking to make sure the updated component is owned by a pawn (so the root component is fine). It seems to not like the capsule component though and just goes on the grab the next item in the hierarchy which is the mesh and applies the updates to that. There are no error messages or log messages. Is this a bug?

I read through PawnMovementComponent.cpp, FloatingPawnMovement.cpp, MovementComponent.cpp, and CharacterMovementComponent.cpp (bunch of other bits too for pawns and characters).

Is there a reason the capsule will not be updated but only the mesh?

It shouldn’t do that, the Capsule is still the root component right? AFAIK It just casts it against a Primitive Component, so it should be fine…