Couldn’t find parent type for ‘VehiclePawn’ named ‘AWheeledVehiclePawn’ in current module (Package: /Script/Vehicle) or any other module parsed so far.
New to programming , I’m exactly copying the code from YouTube tutorial, help please? UE v 4.26.1 Xcode v 12.4
It’s hard to tell without seeing the code. Maybe you forgot to include the header of AWheeledVehiclePawn at the top?
this is my code
VehiclePawn.cpp
// Fill out your copyright notice in the Description page of Project Settings.
include “VehiclePawn.h”
include “Components/SkeletalMeshComponent.h”
include “Camera/CameraComponent.h”
include “GameFramework/SpringArmComponent.h”
include “Components/InputComponent.h”
include “WheeledVehicleMovementComponent4W.h”
static const FName NAME_SteerInput(“Steer”);
static const FName NAME_ThrottleInput(“Throttle”);
AWheeledVehiclePawn::AWheeledVehiclePawn()
{
UWheeledVehicleMovementComponent4W* Vehicle4W = CastChecked<UWheeledVehicleMovementComponent4W>(GetVehicleMovement());
Vehicle4W->MinNormalizedTireLoad = 0.0f;
Vehicle4W->MinNormalizedTireLoadFiltered = 0.2f;
Vehicle4W->MaxNormalizedTireLoad = 2.0f;
Vehicle4W->MaxNormalizedTireLoadFiltered = 2.0f;
Vehicle4W->MaxEngineRPM = 5700.0f;
Vehicle4W->EngineSetup.TorqueCurve.GetRichCurve()->Reset();
Vehicle4W->EngineSetup.TorqueCurve.GetRichCurve()->AddKey(0.0f, 400.0f);
Vehicle4W->EngineSetup.TorqueCurve.GetRichCurve()->AddKey(1890.0f , 500.0f);
Vehicle4W->EngineSetup.TorqueCurve.GetRichCurve()->AddKey(5730.0f , 400.0f);
Vehicle4W->SteeringCurve.GetRichCurve()->Reset();
Vehicle4W->SteeringCurve.GetRichCurve()->AddKey(0.0f,1.0f);
Vehicle4W->SteeringCurve.GetRichCurve()->AddKey(40.0f, 0.7f);
Vehicle4W->SteeringCurve.GetRichCurve()->AddKey(120.0f,0.6f);
Vehicle4W->DifferentialSetup.DifferentialType = EVehicleDifferential4W::LimitedSlip_4W;
Vehicle4W->DifferentialSetup.FrontRearSplit = 0.65f;
Vehicle4W->TransmissionSetup.bUseGearAutoBox = true;
Vehicle4W->TransmissionSetup.GearSwitchTime = 0.15f;
Vehicle4W->TransmissionSetup.GearAutoBoxLatency = 1.0f;
SpringArm = CreateDefaultSubobject<USpringArmComponent>(TEXT(“SpringArm”));
SpringArm->SetupAttachment(RootComponent);
SpringArm->TargetArmLength = 250.0f;
SpringArm->bUsePawnControlRotation = true;
Camera = CreateDefaultSubobject<UCameraComponent>(TEXT(“ChaseCamera”));
Camera->SetupAttachment(SpringArm,USpringArmComponent::SocketName);
Camera->FieldOfView = 90.0f;
}
void AWheeledVehiclePawn::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
UpdateInAirControl(DeltaTime);
}
void AWheeledVehiclePawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAxis(NAME_ThrottleInput, this, &AVehiclePawn::ApplyThrottle);
PlayerInputComponent->BindAxis(NAME_SteerInput , this, &AVehiclePawn::ApplySteering);
PlayerInputComponent->BindAxis(“LookUp”, this, &AVehiclePawn::LookUp);
PlayerInputComponent->BindAxis(“Turn”, this, &AVehiclePawn::Turn);
PlayerInputComponent->BindAction(“Handbrake”, IE_Pressed, this, &AVehiclePawn::OnHandbrakePressed);
PlayerInputComponent->BindAction(“Handbrake”, IE_Released, this, &AVehiclePawn::OnHandbrakeReleased);
}
void AWheeledVehiclePawn::ApplyThrottle(float Val)
{
GetVehicleMovementComponent()->SetThrottleInput(Val);
}
void AWheeledVehiclePawn::ApplySteering(float Val)
{
GetVehicleMovementComponent()->SetSteeringInput(Val);
}
void AWheeledVehiclePawn::LookUp(float Val)
{
if(Val !=0.f)
{
AddControllerPitchInput(Val);
}
}
void AWheeledVehiclePawn::Turn(float Val)
{
if(Val !=0.f)
{
AddControllerYawInput(Val);
}
}
void AWheeledVehiclePawn::OnHandbrakePressed(float Val)
{
GetVehicleMovementComponent()->SetHandbrakeInput(true);
}
void AWheeledVehiclePawn::OnHandbrakeReleased(float Val)
{
GetVehicleMovementComponent()->SetHandbrakeInput(false);
}
void AWheeledVehiclePawn::UpdateInAirControl(float DeltaTime)
{
}
[HR][/HR]
VehiclePawn.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
include “CoreMinimal.h”
include “WheeledVehicle.h”
include “VehiclePawn.generated.h”
/**
*/
UCLASS()
class VEHICLE_API AVehiclePawn : public AWheeledVehiclePawn
{
GENERATED_BODY()
public:
AWheeledVehiclePawn();
virtual void Tick(float DeltaTime) override;
virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override;
void ApplyThrottle(float Val);
void ApplySteering(float Val);
void LookUp(float Val);
void Turn(float Val);
void OnHandbrakePressed();
void OnHandbrakeReleased();
void UpdateInAirControl(float DeltaTime);
protected:
UPROPERTY(Category = Camera,EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = “true” ))
class USpringArmComponent* SpringArm;
UPROPERTY ( Category = Camera, EditDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = “true”))
class UCameraComponent* Camera;
};