38 UE_LOG(LogCarla, Warning, TEXT(
"Error: Owner is not properly set for UCarSimManagerComponent") );
43 FActorSpawnParameters SpawnParams;
44 SpawnParams.SpawnCollisionHandlingOverride =
45 ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
50 CarSimMovementComponent = NewObject<UCarSimMovementComponent>(OffsetActor);
53 CarlaVehicle->GetVehicleMovementComponent()->SetComponentTickEnabled(
false);
54 CarlaVehicle->GetVehicleMovementComponent()->Deactivate();
55 CarSimMovementComponent->DisableVehicle =
false;
56 CarSimMovementComponent->VsConfigFile =
SimfilePath;
57 CarSimMovementComponent->Activate();
58 CarSimMovementComponent->RegisterComponent();
60 CarSimMovementComponent->ResetVsVehicle(
false);
62 CarSimMovementComponent->SyncVsVehicleLocOri();
63 CarSimMovementComponent->SetComponentTickEnabled(
true);
65 CarlaVehicle->GetMesh()->PhysicsTransformUpdateMode = EPhysicsTransformUpdateMode::ComponentTransformIsKinematic;
66 auto * Bone =
CarlaVehicle->GetMesh()->GetBodyInstance(NAME_None);
69 Bone->SetInstanceSimulatePhysics(
false);
75 CarlaVehicle->GetMesh()->SetCollisionResponseToChannel(ECollisionChannel::ECC_WorldStatic, ECollisionResponse::ECR_Overlap);
78 CarlaVehicle->GetMesh()->SetCollisionResponseToChannel(ECollisionChannel::ECC_Visibility, ECollisionResponse::ECR_Overlap);
81 CarlaVehicle->AttachToActor(OffsetActor, FAttachmentTransformRules::KeepWorldTransform);
83 UE_LOG(LogCarla, Warning, TEXT(
"Error: CarSim plugin is not enabled") );
111 CarlaVehicle->GetMesh()->SetPhysicsLinearVelocity(FVector(0,0,0),
false,
"Vehicle_Base");
112 CarlaVehicle->GetVehicleMovementComponent()->SetComponentTickEnabled(
true);
113 CarlaVehicle->GetVehicleMovementComponent()->Activate();
114 CarlaVehicle->GetMesh()->PhysicsTransformUpdateMode = EPhysicsTransformUpdateMode::SimulationUpatesComponentTransform;
115 auto * Bone =
CarlaVehicle->GetMesh()->GetBodyInstance(NAME_None);
118 Bone->SetInstanceSimulatePhysics(
true);
124 CarlaVehicle->GetMesh()->SetCollisionResponseToChannel(ECollisionChannel::ECC_WorldStatic, ECollisionResponse::ECR_Block);
125 CarlaVehicle->GetMesh()->SetCollisionProfileName(
"Vehicle");
void OnCarSimOverlap(UPrimitiveComponent *OverlappedComponent, AActor *OtherActor, UPrimitiveComponent *OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult &SweepResult)