When a code class deriving from WheeledVehicleMovementComponent is created in a Vehicle Advanced template project, the user is required to include a constructor for the FWheelSetup struct in WheeledVehicleMovementComponent because the constructor is included in the .cpp file for that class instead of in the .h file.

Steps to Reproduce
  1. Create a new project using the code Vehicle Advanced template.
  2. Build the project in Visual Studio.
  3. Open the project in the Editor.
  4. Add a new code class derived from WheeledVehicleMovementComponent. Name the class MyWheeledVehMoveComp.
  5. Close the Editor.
  6. Reload the solution in Visual Studio.
  7. In the header file for the new class, change GENERATED_BODY() to GENERATED_UCLASS_BODY() and add the following code:
    	virtual void SetupVehicle() override;
  8. In the .cpp file for the new class, add the following code:
    #include "Vehicles/VehicleWheel.h"
    // ...
    UMyWheeledVehMoveComp::UMyWheeledVehMoveComp(const FObjectInitializer& ObjectInitializer)
    	: Super(ObjectInitializer)
    void UMyWheeledVehMoveComp::SetupVehicle()
    	for (int32 WheelIdx = 0; WheelIdx < WheelSetups.Num(); ++WheelIdx)
    		const FWheelSetup& WheelSetup = WheelSetups[WheelIdx];
    		if (WheelSetup.BoneName == NAME_None)
  9. Build the project in Visual Studio.

The build fails with an unresolved external error.

The build completes successfully.

Adding the following code to the .cpp file of the new class allows the project to build successfully:

FWheelSetup::FWheelSetup() : WheelClass(UVehicleWheel::StaticClass()), BoneName(NAME_None), AdditionalOffset(0.0f)


This is a copy of the constructor for the FWheelSetup struct in WheeledVehicleMovementComponent.

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

Login to Vote

ComponentUE - Simulation - Physics
Affects Versions4.5.14.7
Fix Commit2366444
CreatedNov 19, 2014
ResolvedNov 20, 2014
UpdatedApr 27, 2018