Change the usage of
PlayerInputComponent->BindAxis
to
InputComponent->BindAxis
Change the usage of
PlayerInputComponent->BindAxis
to
InputComponent->BindAxis
I am trying to create a Pawn from a video and i get some errors, can you help?
Error 1:
identifier “PlayerInputComponent” is undefined 37/38
Error 2:
name followed by ‘::’ must be a class or namespace name 37/38
Error 3:
left of ‘->BindAxis’ must point to class/struct/union/generic type 37/38
Error 4:
‘MyPawn’: is not a class or namespace name 37/38
Error 5:
‘&’: illegal operation on bound member function expression 37/38
Error 6:
The command ““C:\Program Files\Epic Games\UE_4.11\Engine\Build\BatchFiles\Build.bat” MyProject5Editor Win64 Development “C:\Users\Ottmain\Documents\Unreal Projects\MyProject5\MyProject5.uproject” -waitmutex -2015” exited with code -1. line 1
Error 7:
Failed to produce item: C:\Users\Ottmain\Documents\Unreal Projects\MyProject5\Binaries\Win64\UE4Editor-MyProject5.pdb
line 1
Here is the code of the cpp file:
// Fill out your copyright notice in the Description page of Project Settings.
#include “MyProject5.h”
#include “MyPawn.h”
#include “Components/InputComponent.h”
#include “GameFramework/FloatingPawnMovement.h”
// Sets default values
AMyPawn::AMyPawn()
{
// 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;
}
// Called when the game starts or when spawned
void AMyPawn::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AMyPawn::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
}
// Called to bind functionality to input
void AMyPawn::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
Super::SetupPlayerInputComponent(InputComponent);
PlayerInputComponent->BindAxis("MoveForward", this, &MyPawn::MoveForward);
PlayerInputComponent->BindAxis("MoveRight", this, &MyPawn::MoveRight);
}
void AMyPawn::MoveForward(float Value)
{
AddMovementInput(GetActorForwardVector(), Value);
}
void AMyPawn::MoveRight(float Value)
{
AddMovementInput(GetActorRightVector(), Value);
}
Please help. Thank you
Thank you trying that
Didnt Get Those errors anymore