Mowing A Pawn

Hi all can any one explain how can I move a pawn ? What it is I have a character class witch simply inherits from pawn and defines multiple components such as CameraComponent, USpringArmComponent, PaperFlipBookComponent, UBoxComponent and UPawnMovementComponent, but I have no Idea how can I move it you can find my code below, this is basically entire code so far in object constructor

	// Set this pawn to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

	/*************************************** BoxComponent ********************************************/

	// Create BoxComponent and set is as root
	verify((RootComponent = m_collisionBox = CreateDefaultSubobject<UBoxComponent>(TEXT("PlayerCollisionBox"))) != nullptr &&
		   TEXT("Failed To Create UBoxComponent"));


	m_collisionBox->SetCollisionResponseToChannel(PlatformTypeCollisionChannel, ECollisionResponse::ECR_Overlap);
	m_collisionBox->SetCollisionResponseToChannel(ClimbableTypeCollisionChannel, ECollisionResponse::ECR_Overlap);
	m_collisionBox->SetCollisionResponseToChannel(WorldStaticTileType, ECollisionResponse::ECR_Block);

	// Ray Cast controller will be used 
	// to move pawn and proceed collisions 
	m_controller.SetPlayerBox(m_collisionBox); // This has nothing to do with movement yet !!!

	/*************************************** Camera ************************************************/

	// Create a camera boom attached to the root (capsule)
	verify((m_cameraBoom = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraBoom"))) != nullptr &&
		   TEXT("Failed To Create USpringArmComponent"));

	m_cameraBoom->TargetArmLength = 500.0f;
	m_cameraBoom->SocketOffset = FVector(0.0f, 0.0f, 0.0f);
	m_cameraBoom->bAbsoluteRotation = true;
	m_cameraBoom->bDoCollisionTest = false;
	m_cameraBoom->RelativeRotation = FRotator(0.0f, -90.0f, 0.0f);

	// Create camera and attach it to the boom
	verify((m_sideViewCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("SideViewCamera"))) != nullptr &&
		   TEXT("Failed To Create UCameraComponent"));

	m_sideViewCameraComponent->ProjectionMode = ECameraProjectionMode::Orthographic;
	m_sideViewCameraComponent->OrthoWidth = 800.0f;
	m_sideViewCameraComponent->AttachTo(m_cameraBoom, USpringArmComponent::SocketName);

	// Prevent all automatic rotation behavior on the camera, character, and camera component
	m_cameraBoom->bAbsoluteRotation = true;
	m_sideViewCameraComponent->bUsePawnControlRotation = false;
	m_sideViewCameraComponent->bAutoActivate = true;

	/************************************* Animations ************************************************/
	m_runningAnimation = ConstructorHelpers::FObjectFinderOptional<UPaperFlipbook>(TEXT("PaperFlipbook'/Game/Sprites/Player/PlayerRun.PlayerRun'")).Get();
	m_fallingAnimation = ConstructorHelpers::FObjectFinderOptional<UPaperFlipbook>(TEXT("PaperFlipbook'/Game/Sprites/Player/PlayerFalling.PlayerFalling'")).Get();
	m_idleAnimation = ConstructorHelpers::FObjectFinderOptional<UPaperFlipbook>(TEXT("PaperFlipbook'/Game/Sprites/Player/PlayerIdle.PlayerIdle'")).Get();

	// Create paperFlipbook
	verify((m_sprite = CreateDefaultSubobject<UPaperFlipbookComponent>(TEXT("PlayerFlipBookComponent"))) != nullptr &&
		   TEXT("Failed To Create UPaperFlipbookComponent"));


	// Set sprite offset so it fits in collision box
	m_sprite->AddLocalOffset(FVector(0.0f, 0.0f, FMath::Abs(m_collisionBox->Bounds.BoxExtent.Z / 2)));

	/************************************* Pawn movement ************************************************/
	verify((m_pawnMovement = CreateDefaultSubobject<UPawnMovementComponent>(TEXT("PlayerMovementController"))) != nullptr &&
		   TEXT("Failed To Create UPawnMovementComponent"));

	m_pawnMovement->UpdatedComponent = RootComponent;

And than in Tick() just to test it I call

	m_pawnMovement->AddInputVector(FVector(0.0f, 0.0f,-200));

but unfortunately nothing happens can anyone explain what I’m doing wrong ?

For movement of pawn check out template projects like First Person Shooter
you have to have input controller in your code and define input in unreal editor

1st case (input control pawn/posses)
like this in .cpp file:

    void AMyPawn::SetupPlayerInputComponent(class UInputComponent* InputComponent)
    	InputComponent->BindAxis("MouseDrag", this, &AMyPawn::MoveRight);

void AMyPawn::MoveRight(float Value)
	if (Value != 0.0f)
		if (bIsSprinting)
			Value *= 2;
		// add movement in that direction
		AddMovementInput(GetActorRightVector(), Value);

and in .h file

	virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;

after that just possess pawn with on click or something in your player controller
what is your project about?

2nd case (just move actor/pawn, don’t possess)
if you want to move it with no controller, but just it’s location, you don’t need it to be pawn class, it can also be just actor class
in that case put in constructor of pawn/actor:

    MyActorMesh->OnClicked.AddDynamic(this, &AMyActor::MoveObject);

and make method MoveObject() like:

this->SetActorRelativeLocation(FVector(0.0f, 0.0f, -200.0f));

Sorted !!!
I was missing one thing
I’ve created UPawnMovementComponent directly in my pawn class without actually creating new c++ class witch means I was trying to instantiate “abstract” object witch is illegal, however the error showed up after I’ve regenerated vs project files when it showed up I’ve realized whats wrong so created new c++ object derived from UPawnMovementComponent
and added code to it from this tutorial

All working perfect ! Thanks anyway !