I am trying to create a custom Pawn with behavior similar to DefaultPawn.That’s floating camera (move and rotate )
the code looks like this now:
ASLPawn::ASLPawn()
{
// 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;
mMovementComponent = CreateDefaultSubobject<UPawnMovementComponent,UFloatingPawnMovement>("SL_movement");
mDummyMesh = CreateDefaultSubobject<UStaticMeshComponent>("SL_m1");
mCam = CreateDefaultSubobject<UCameraComponent>("cam1");
}
// Called when the game starts or when spawned
void ASLPawn::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void ASLPawn::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
// Called to bind functionality to input
void ASLPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAxis("MoveForward", this, &ASLPawn::MoveForward);
PlayerInputComponent->BindAxis("MoveRight", this, &ASLPawn::MoveRight);
PlayerInputComponent->BindAxis("Turn", this, &ASLPawn::Turn);
PlayerInputComponent->BindAxis("LookUp", this, &ASLPawn::LookUp);
}
UPawnMovementComponent* ASLPawn::GetMovementComponent() const
{
return mMovementComponent;
}
void ASLPawn::MoveForward(float value)
{
AddMovementInput(GetActorForwardVector(), value);
}
void ASLPawn::MoveRight(float value)
{
AddMovementInput(GetActorRightVector(), value);
}
void ASLPawn::Turn(float value)
{
AddControllerYawInput(value);
}
void ASLPawn::LookUp(float value)
{
AddControllerPitchInput(value);
}
What happens is that the move left,right,forward,backward works. But Yaw and Pitch doesn’t change. I debugged the
callback functions Turn() and LookUp() - those are being triggered during mouse movement.But nothing happens to the pawn.What am I missing here?