Hi,
I’m spawning vehicle dynamically and making it to move along spline path.
//Spawn Vehicle
AVehicle* vehicle = Cast<AVehicle>(UAIBlueprintHelperLibrary::SpawnAIFromClass(GetWorld(), AVehicle::StaticClass(), nullptr, StartPosition, StartRotation));
/* Getting "LogVehicleSpawner: Display: setPlugin()
LogVehicles: Warning: Cannot create vehicle for /Game/Maps/UEDPIE_0_Map2.Map2:PersistentLevel.Vehicle_0.MovementComp. UpdatedComponent has not initialized its rigid body actor." at this point */
UClass* AnimBP = StaticLoadClass(UObject::StaticClass(), NULL, *AnimBPRef);
if (!AnimBP) { return; }
//Successfully able to apply AnimBP
vehicle->GetMesh()->SetAnimInstanceClass(AnimBP);
USkeletalMesh* SkeletalMesh = Cast<USkeletalMesh>(StaticLoadObject(USkeletalMesh::StaticClass(), NULL, *VehicleMeshRef));
if (!SkeletalMesh) { return; }
//Successfully able to apply Vehicle Mesh
vehicle->GetMesh()->SetSkeletalMesh(SkeletalMesh);
After all this vehicle not moving at all. It’s wheels are handing - See pic
Observation 1: When i set Auto Posses Player to Player0 vehicle starts to move perfectly as expected see second pic
Observation 2: When I make some changes to Wheel bone names and reset it back, again vehicle starts to move perfectly as expected
I don’t have single clue about the warning message “UpdatedComponent has not initialized its rigid body actor”.
It is working perfectly when i spawn vehicle with following code in constructor.
static ConstructorHelpers::FObjectFinder<USkeletalMesh> CarMesh(TEXT("/Game/KIA_2/UE4_SedanSkel_KIA.UE4_SedanSkel_KIA"));
GetMesh()->SetSkeletalMesh(CarMesh.Object);
static ConstructorHelpers::FClassFinder<UObject> AnimBPClass(TEXT("/Game/KIA_2/ABP_KIA_2"));
GetMesh()->SetAnimInstanceClass(AnimBPClass.Class);
I can’t rely on this, because I want to supply mesh dynamically since I’ve hundreds of vehicles. I think i missed something very obvious. I’m struggling with this for 3 days please help.