Hello
Im just started blank project and swap DefaultPawn to ASandboxPawn
// Copyright Epic Games, Inc. All Rights Reserved.
#include "GeometrySandboxGameModeBase.h"
#include "SandboxPawn.h"
AGeometrySandboxGameModeBase::AGeometrySandboxGameModeBase()
{
DefaultPawnClass = ASandboxPawn::StaticClass();
}
Then mapped axis
On my pawn i setup a PlayerInputComponent
// Called to bind functionality to input
void ASandboxPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAxis("MoveForward", this, &ASandboxPawn::MoveForward);
PlayerInputComponent->BindAxis("MoveRight", this, &ASandboxPawn::MoveRight);
}
Then make function that
void ASandboxPawn::MoveForward(float Amount)
{
UE_LOG(LogSandboxPawn, Display, TEXT("Move Forward: %f"), Amount);
VelocityVector.X = Amount;
}
void ASandboxPawn::MoveRight(float Amount)
{
UE_LOG(LogSandboxPawn, Display, TEXT("Move Right: %f"), Amount);
VelocityVector.Y = Amount;
}
Then on tick update the NewLocation
// Called every frame
void ASandboxPawn::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
if (VelocityVector.IsZero())
{
const FVector NewLocation = GetActorLocation() + Velocity * DeltaTime * VelocityVector;
SetActorLocation(NewLocation);
}
}
Compilation success
UE_LOG showing that function works, but button that i mapped doesnt work and camera is still, i think its cause due New PlayerInput classes on UnrealEngine 5, IDE Rider shows that
i did it before exact same on UE4 was working, what can be cause of this??
