|
CARLA
|
Assign a random route to every ACarlaWheeledVehicle entering the trigger volume. More...
#include <RoutePlanner.h>
Inheritance diagram for ARoutePlanner:Public Member Functions | |
| void | AddRoute (float probability, const TArray< FVector > &routePoints) |
| ARoutePlanner (const FObjectInitializer &ObjectInitializer) | |
| void | AssignRandomRoute (AWheeledVehicleAIController &Controller) const |
| virtual void | BeginDestroy () override |
| void | CleanRoute () |
| void | DrawRoutes () |
| void | Init () |
| void | SetBoxExtent (const FVector &Extent) |
Static Public Member Functions | |
| static bool | FindRoadFlowRotationAtLocation (const UObject *WorldContextObject, const FVector &Location, float SearchRadius, FRotator &OutRotation) |
| Searches every ARoutePlanner in the world for the route spline point closest to Location, and returns the road direction there (as a rotator built from the spline tangent). | |
Public Attributes | |
| bool | bIsIntersection = false |
| TArray< float > | Probabilities |
| TArray< TObjectPtr< USplineComponent > > | Routes |
| TObjectPtr< UBoxComponent > | TriggerVolume |
Protected Member Functions | |
| virtual void | BeginPlay () override |
| virtual void | EndPlay (EEndPlayReason::Type EndPlayReason) override |
| void | OnTriggerBeginOverlap (UPrimitiveComponent *OverlappedComp, AActor *OtherActor, UPrimitiveComponent *OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult &SweepResult) |
Assign a random route to every ACarlaWheeledVehicle entering the trigger volume.
Routes must be added in editor after placing this actor into the world. Spline tangents are ignored, only locations are taken into account for making the route.
Definition at line 24 of file RoutePlanner.h.
| ARoutePlanner::ARoutePlanner | ( | const FObjectInitializer & | ObjectInitializer | ) |
Definition at line 51 of file RoutePlanner.cpp.
References TriggerVolume.
| void ARoutePlanner::AddRoute | ( | float | probability, |
| const TArray< FVector > & | routePoints | ||
| ) |
Definition at line 99 of file RoutePlanner.cpp.
References Probabilities, and Routes.
Referenced by AOpenDriveActor::BuildRoutes().
| void ARoutePlanner::AssignRandomRoute | ( | AWheeledVehicleAIController & | Controller | ) | const |
Definition at line 126 of file RoutePlanner.cpp.
References AWheeledVehicleAIController::GetRandomEngine(), IsValid(), PickARoute(), Probabilities, Routes, and AWheeledVehicleAIController::SetFixedRoute().
Referenced by OnTriggerBeginOverlap().
|
overridevirtual |
Definition at line 69 of file RoutePlanner.cpp.
References CleanRoute().
|
overrideprotectedvirtual |
Definition at line 221 of file RoutePlanner.cpp.
References Init().
| void ARoutePlanner::CleanRoute | ( | ) |
Definition at line 120 of file RoutePlanner.cpp.
References Probabilities, and Routes.
Referenced by BeginDestroy().
| void ARoutePlanner::DrawRoutes | ( | ) |
Definition at line 253 of file RoutePlanner.cpp.
References bIsIntersection, and Routes.
|
overrideprotectedvirtual |
Definition at line 227 of file RoutePlanner.cpp.
References OnTriggerBeginOverlap(), and TriggerVolume.
|
static |
Searches every ARoutePlanner in the world for the route spline point closest to Location, and returns the road direction there (as a rotator built from the spline tangent).
Used by editor tools that want to align spawned props (e.g. road decals) to the flow of traffic. Returns false, leaving OutRotation untouched, if no route spline point is found within SearchRadius.
Definition at line 153 of file RoutePlanner.cpp.
References IsSplineValid().
| void ARoutePlanner::Init | ( | ) |
Definition at line 197 of file RoutePlanner.cpp.
References IsSplineValid(), OnTriggerBeginOverlap(), Routes, and TriggerVolume.
Referenced by BeginPlay().
|
protected |
Definition at line 238 of file RoutePlanner.cpp.
References AssignRandomRoute(), and GetVehicleController().
|
inline |
Definition at line 36 of file RoutePlanner.h.
References TriggerVolume.
Referenced by AOpenDriveActor::BuildRoutes().
| bool ARoutePlanner::bIsIntersection = false |
Definition at line 94 of file RoutePlanner.h.
Referenced by AOpenDriveActor::BuildRoutes(), and DrawRoutes().
| TArray<float> ARoutePlanner::Probabilities |
Definition at line 91 of file RoutePlanner.h.
Referenced by AddRoute(), AssignRandomRoute(), and CleanRoute().
| TArray<TObjectPtr<USplineComponent> > ARoutePlanner::Routes |
Definition at line 88 of file RoutePlanner.h.
Referenced by AddRoute(), AssignRandomRoute(), CleanRoute(), DrawRoutes(), and Init().
| TObjectPtr<UBoxComponent> ARoutePlanner::TriggerVolume |
Definition at line 85 of file RoutePlanner.h.
Referenced by ARoutePlanner(), EndPlay(), and Init().