17 : Super(ObjectInitializer)
19 PrimaryActorTick.bCanEverTick =
true;
26 return SensorDefinition;
32 Super::Set(Description);
45 #if !(UE_BUILD_SHIPPING || UE_BUILD_TEST) 56 const FVector &Start = GetActorLocation();
57 const FVector &End = Start + (GetActorForwardVector() *
Distance);
58 UWorld* CurrentWorld = GetWorld();
61 FHitResult HitOut = FHitResult();
64 FCollisionQueryParams TraceParams(FName(TEXT(
"ObstacleDetection Trace")),
true,
this);
66 #if !(UE_BUILD_SHIPPING || UE_BUILD_TEST) 71 const FName TraceTag(
"ObstacleDebugTrace");
72 CurrentWorld->DebugDrawTraceTag = TraceTag;
73 TraceParams.TraceTag = TraceTag;
78 TraceParams.bTraceComplex =
true;
81 TraceParams.bIgnoreTouches =
true;
84 TraceParams.bReturnPhysicalMaterial =
false;
87 TraceParams.AddIgnoredActor(
this);
88 if(Super::GetOwner()!=
nullptr)
89 TraceParams.AddIgnoredActor(Super::GetOwner());
97 FCollisionObjectQueryParams TraceChannel = FCollisionObjectQueryParams(
98 FCollisionObjectQueryParams::AllDynamicObjects);
99 isHitReturned = CurrentWorld->SweepSingleByObjectType(
112 ECollisionChannel TraceChannel = ECC_WorldStatic;
113 isHitReturned = CurrentWorld->SweepSingleByChannel(
133 const FHitResult &Hit)
135 if ((Actor !=
nullptr) && (OtherActor !=
nullptr))
const UCarlaEpisode * Episode
static void MakeObstacleDetectorDefinitions(const FString &Type, const FString &Id, FActorDefinition &Definition)
void Set(const FActorDescription &Description) override
carla::rpc::Actor SerializeActor(FCarlaActor *CarlaActor) const
Create a serializable object describing the actor.
static FActorDefinition GetSensorDefinition()
const UCarlaEpisode & GetEpisode() const
static float RetrieveActorAttributeToFloat(const FString &Id, const TMap< FString, FActorAttribute > &Attributes, float Default)
A definition of a Carla Actor with all the variation and attributes.
virtual void PostPhysTick(UWorld *World, ELevelTick TickType, float DeltaSeconds) override
TMap< FString, FActorAttribute > Variations
User selected variations of the actor.
carla::SharedPtr< cc::Actor > Actor
void OnObstacleDetectionEvent(AActor *Actor, AActor *OtherActor, float Distance, const FHitResult &Hit)
A description of a Carla Actor with all its variation.
AObstacleDetectionSensor(const FObjectInitializer &ObjectInitializer)
FAsyncDataStream GetDataStream(const SensorT &Self)
Return the FDataStream associated with this sensor.
static bool RetrieveActorAttributeToBool(const FString &Id, const TMap< FString, FActorAttribute > &Attributes, bool Default)
void Send(SensorT &Sensor, ArgsT &&... Args)
Send some data down the stream.