Download

Simple wheeled vehicle movement component does not move, unable to create vehicle

(Ver 4.22)

I am making a vehicle using the simple wheeled vehicle movement component. The vehicle will be loaded from a text file (defines how it looks, and what settings will be used for movement). I am testing it, but it is sitting like a brick event when input is given. I have been seeing the warning:

LogVehicles: Warning: Cannot create vehicle. UpdatedComponent has not initialized its rigid body actor.

This is sent when I call RecreatePhysicsState(). I have been stuck on this for a while, can anyone help me understand what the problem here is.

Constructor:

PrimaryActorTick.bCanEverTick = true;
mesh = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("Mesh"));
const ConstructorHelpers::FObjectFinder<UAnimBlueprint> anim(TEXT("AnimBlueprint'/Game/components/frame__Skeleton_AnimBlueprint.frame__Skeleton_AnimBlueprint'"));
mesh->SetAnimInstanceClass(anim.Object->GeneratedClass);
RootComponent = mesh;

movement = CreateDefaultSubobject<USimpleWheeledVehicleMovementComponent>(TEXT("simple_movement"));
movement->SetIsReplicated(true);
movement->SetUpdatedComponent(mesh);

Movement Init (called at begin play event)

FAbstractVehicle abs = loadVehicleFromFile();
movement->Mass =  abs.mass;
movement->ChassisHeight = abs.chassisHeight;
movement->ChassisWidth = abs.chassisWidth;

movement->WheelSetups.Reserve(abs.wheels.Num());
movement->WheelSetups.SetNum(abs.wheels.Num());
for (int32 i = 0; i < abs.wheels.Num(); i++)
{
	movement->WheelSetups[i].WheelClass = wheelMap[abs.wheels[i].physicsName];
	movement->WheelSetups[i].BoneName = FName(*abs.wheels[i].boneName);
	movement->WheelSetups[i].AdditionalOffset = FVector(0, 0, 0);
}
movement->RecreatePhysicsState();