18 #include "Engine/Classes/Interfaces/Interface_CollisionDataProvider.h" 19 #include "PhysicsCore/Public/BodySetupEnums.h" 23 PrimaryActorTick.bCanEverTick =
false;
24 MeshComponent = CreateDefaultSubobject<UProceduralMeshComponent>(TEXT(
"RootComponent"));
29 : Super(ObjectInitializer)
31 PrimaryActorTick.bCanEverTick =
false;
32 RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT(
"SceneComponent"));
33 SetRootComponent(RootComponent);
34 RootComponent->Mobility = EComponentMobility::Static;
41 if (OpenDrive.IsEmpty())
43 UE_LOG(LogCarla, Error, TEXT(
"The OpenDrive is empty"));
65 UE_LOG(LogCarla, Error, TEXT(
"The OpenDrive has not been loaded"));
81 const auto Meshes = CarlaMap->GenerateChunkedMesh(Parameters);
82 for (
const auto &Mesh : Meshes) {
83 if (!Mesh->GetVertices().size())
89 TempPMC->bUseAsyncCooking =
true;
90 TempPMC->bUseComplexAsSimpleCollision =
true;
91 TempPMC->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
94 TempPMC->CreateMeshSection_LinearColor(
100 TArray<FLinearColor>(),
101 TArray<FProcMeshTangent>(),
111 actor->SetActorHiddenInGame(
true);
136 UE_LOG(LogCarla, Error, TEXT(
"The OpenDrive has not been loaded"));
146 UE_LOG(LogCarla, Error, TEXT(
"The OpenDrive has not been loaded"));
150 const auto Waypoints = CarlaMap->GenerateWaypointsOnRoadEntries();
151 for (
const auto &Wp : Waypoints)
153 const FTransform Trans = CarlaMap->ComputeTransform(Wp);
155 Spawner->SetActorRotation(Trans.GetRotation());
156 Spawner->SetActorLocation(Trans.GetTranslation() + FVector(0.f, 0.f,
SpawnersHeight));
177 auto World = GetWorld();
178 check(World !=
nullptr);
181 AActor* TrafficLightManagerActor = UGameplayStatics::GetActorOfClass(World, ATrafficLightManager::StaticClass());
182 if(TrafficLightManagerActor ==
nullptr) {
Seting for map generation from opendrive without additional geometry.
bool IsOpenDriveValid() const
Checks if the OpenDrive has been loaded and it's valid.
A definition of a Carla Mesh.
AOpenDriveGenerator(const FObjectInitializer &ObjectInitializer)
virtual void BeginPlay() override
Base class for spawner locations for walkers.
The game instance contains elements that must be kept alive in between levels.
TArray< int32 > Triangles
bool LoadOpenDrive(const FString &OpenDrive)
Set the OpenDRIVE information as string and generates the queryable map structure.
const FString & GetOpenDrive() const
Get the OpenDRIVE information as string.
bool enable_mesh_visibility
void GenerateSpawnPoints()
Generates spawn points along the road.
void GenerateRoadMesh()
Generates the road and sidewalk mesh based on the OpenDRIVE information.
float SpawnersHeight
Determine the height where the spawners will be placed, relative to each RoutePlanner.
TArray< FVector > Normals
static ACarlaGameModeBase * GetGameMode(const UObject *WorldContextObject)
static UCarlaGameInstance * GetGameInstance(const UObject *WorldContextObject)
TArray< FVector > Vertices
const boost::optional< carla::road::Map > & GetMap() const
static FString GetXODR(const UWorld *World)
Return the OpenDrive XML associated to MapName, or empty if the file is not found.
static void log_warning(Args &&... args)
const carla::rpc::OpendriveGenerationParameters & GetOpendriveGenerationParameters() const
UProceduralMeshComponent * MeshComponent
TArray< AVehicleSpawnPoint * > VehicleSpawners
TArray< AActor * > ActorMeshList
void GeneratePoles()
Generates pole meshes based on the OpenDRIVE information.
Class In charge of creating and assigning traffic light groups, controllers and components.