Vehicle input not working c++

Hi everyone, I’m new to c++ and ue4 and I’m working on a basic race game with a simple cube as the vehicle. I’ve made a wheeled vehicle and I’ve attempted to add input from the player. My LookUp and Turn functions work perfectly fine but my ApplyThrottle and ApplySteering functions don’t work at all. Also my cube doesn’t drop down onto the track when I press play so that might be part of the problem. Here’s my code.

PlayerVehicle.h:
**#pragma once

#include “CoreMinimal.h”
#include “WheeledVehicle.h”
#include “PlayerVehicle.generated.h”

class USpringArmComponent;
class UCameraComponent;

UCLASS()
class RACINGGAME_API APlayerVehicle : public AWheeledVehicle
{
GENERATED_BODY()

public:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "StaticMesh")
    UStaticMeshComponent* StaticMesh;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Camera")
    USpringArmComponent* SpringArm;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Camera")
    UCameraComponent* Camera;

public:
APlayerVehicle();

// Called to bind functionality to input
virtual void SetupPlayerInputComponent(UInputComponent* InputComponent) override;

// Called every frame
virtual void Tick(float DeltaTime) override;

// Input functions
void ApplyThrottle(float Value);
void ApplySteering(float Value);

void LookUp(float Value);
void Turn(float Value);

void OnHandbrakePressed();
void OnHandbrakeReleased();

};**

PlayerVehicle.cpp:
**#include “PlayerVehicle.h”

#include “Components/StaticMeshComponent.h”
#include “GameFramework/SpringArmComponent.h”
#include “Camera/CameraComponent.h”
#include “WheeledVehicleMovementComponent4W.h”
#include “Components/InputComponent.h”

#include “GameFramework/Controller.h”
#include “Engine.h”

static const FName NAME_SteerInput(“Steer”);
static const FName NAME_ThrottleInput(“Throttle”);

APlayerVehicle::APlayerVehicle()
{
UWheeledVehicleMovementComponent* Vehicle4W = CastChecked<UWheeledVehicleMovementComponent4W>(GetVehicleMovement());

// Adjust tire loading
Vehicle4W-&gt;MinNormalizedTireLoad = 0.0f;  
Vehicle4W-&gt;MinNormalizedTireLoadFiltered = 0.2f;    
Vehicle4W-&gt;MaxNormalizedTireLoad = 2.0f;  
Vehicle4W-&gt;MaxNormalizedTireLoadFiltered = 2.0f;    

// Torque setup which is the turning effect of a car
Vehicle4W-&gt;MaxEngineRPM = 5700.0f;  

// Create a static mesh and set it as the root component
StaticMesh = CreateDefaultSubobject&lt;UStaticMeshComponent&gt;(TEXT("StaticMeshComponent"));
RootComponent = StaticMesh;

// Create a spring arm component
SpringArm = CreateDefaultSubobject&lt;USpringArmComponent&gt;(TEXT("SpringArmComponent"));
SpringArm-&gt;SetupAttachment(RootComponent);

SpringArm-&gt;SetRelativeRotation(FRotator(-15.0f, 0.0f, 0.0f)); 
SpringArm-&gt;TargetArmLength = 500.0f;    
SpringArm-&gt;TargetOffset = FVector(0.0f, 0.0f, 200.0f);  

SpringArm-&gt;bInheritPitch = true;
SpringArm-&gt;bInheritYaw = true;
SpringArm-&gt;bInheritRoll = false;

// Lock the spring arm's rotation to follow controller input
SpringArm-&gt;bUsePawnControlRotation = true;

SpringArm-&gt;bAbsoluteRotation = false;

// Create a following camera component
Camera = CreateDefaultSubobject&lt;UCameraComponent&gt;(TEXT("CameraComponent"));
Camera-&gt;SetupAttachment(SpringArm, USpringArmComponent::SocketName);

bUseControllerRotationPitch = true;
bUseControllerRotationYaw = true;
bUseControllerRotationRoll = false;

// Auto possess player
AutoPossessPlayer = EAutoReceiveInput::Player0;

}

void APlayerVehicle::Tick(float DeltaTime)
{
}

void APlayerVehicle::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
Super::SetupPlayerInputComponent(InputComponent);

InputComponent-&gt;BindAxis(NAME_ThrottleInput, this, &APlayerVehicle::ApplyThrottle);
InputComponent-&gt;BindAxis(NAME_SteerInput, this, &APlayerVehicle::ApplySteering);
InputComponent-&gt;BindAxis("LookUp", this, &APlayerVehicle::LookUp);
InputComponent-&gt;BindAxis("Turn", this, &APlayerVehicle::Turn);

InputComponent-&gt;BindAction("Handbrake", IE_Pressed, this, &APlayerVehicle::OnHandbrakePressed);
InputComponent-&gt;BindAction("Handbrake", IE_Pressed, this, &APlayerVehicle::OnHandbrakeReleased);

}

void APlayerVehicle::ApplyThrottle(float Value)
{
GetVehicleMovementComponent()->SetThrottleInput(Value);
}

void APlayerVehicle::ApplySteering(float Value)
{
GetVehicleMovementComponent()->SetSteeringInput(Value);
}

void APlayerVehicle::LookUp(float Value)
{
if (Value != 0)
AddControllerPitchInput(Value);
}

void APlayerVehicle::Turn(float Value)
{
if (Value != 0)
AddControllerYawInput(Value);
}

void APlayerVehicle::OnHandbrakePressed()
{
GetVehicleMovementComponent()->SetHandbrakeInput(true);
}

void APlayerVehicle::OnHandbrakeReleased()
{
GetVehicleMovementComponent()->SetHandbrakeInput(false);
}**

Any help is much appreciated, thanks :slight_smile:

I think your input value is empty,you can check it. You did not set the input value when you bind the key and call the function in code.