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->SetMobility(EComponentMobility::Movable);
m_collisionBox->SetCollisionEnabled(ECollisionEnabled::Type::QueryAndPhysics);
m_collisionBox->SetCollisionObjectType(ECollisionChannel::ECC_Pawn);
m_collisionBox->SetCollisionResponseToChannel(PlatformTypeCollisionChannel, ECollisionResponse::ECR_Overlap);
m_collisionBox->SetCollisionResponseToChannel(ClimbableTypeCollisionChannel, ECollisionResponse::ECR_Overlap);
m_collisionBox->SetCollisionResponseToChannel(WorldStaticTileType, ECollisionResponse::ECR_Block);
m_collisionBox->SetMobility(EComponentMobility::Movable);
// 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->AttachTo(RootComponent);
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"));
m_sprite->SetFlipbook(m_idleAnimation);
m_sprite->AttachTo(RootComponent);
// 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->SetActive(true);
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 ?