CARLA
TrafficSignBase.cpp
Go to the documentation of this file.
1 // Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
2 // de Barcelona (UAB).
3 //
4 // This work is licensed under the terms of the MIT license.
5 // For a copy, see <https://opensource.org/licenses/MIT>.
6 
7 #include "Carla.h"
8 #include "TrafficSignBase.h"
9 #include "SignComponent.h"
10 
11 ATrafficSignBase::ATrafficSignBase(const FObjectInitializer &ObjectInitializer)
12  : Super(ObjectInitializer) {
13  PrimaryActorTick.bCanEverTick = false;
14 
15  RootComponent =
16  ObjectInitializer.CreateDefaultSubobject<USceneComponent>(this, TEXT("SceneRootComponent"));
17  RootComponent->SetMobility(EComponentMobility::Static);
18 }
19 
20 TArray<UBoxComponent*> ATrafficSignBase::GetTriggerVolumes() const
21 {
22  TArray<USignComponent*> Components;
23  GetComponents<USignComponent>(Components, false);
24  if (Components.Num())
25  {
26  USignComponent* SignComponent = Components[0];
27  return SignComponent->GetEffectTriggerVolume();
28  }
29  else
30  {
31  TArray<UBoxComponent*> TriggerVolumes;
32  TriggerVolumes.Add(GetTriggerVolume());
33  return TriggerVolumes;
34  }
35 }
TArray< UBoxComponent * > GetTriggerVolumes() const
UBoxComponent * GetTriggerVolume() const
ATrafficSignBase(const FObjectInitializer &ObjectInitializer)