60 const FVector &Start = GetActorLocation();
61 const FVector &End = Start + (GetActorForwardVector() *
Distance);
62 UWorld* CurrentWorld = GetWorld();
65 FHitResult HitOut = FHitResult();
68 FCollisionQueryParams TraceParams(FName(TEXT(
"ObstacleDetection Trace")),
true,
this);
70#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
75 const FName TraceTag(
"ObstacleDebugTrace");
76 CurrentWorld->DebugDrawTraceTag = TraceTag;
77 TraceParams.TraceTag = TraceTag;
82 TraceParams.bTraceComplex =
true;
85 TraceParams.bIgnoreTouches =
true;
88 TraceParams.bReturnPhysicalMaterial =
false;
91 TraceParams.AddIgnoredActor(
this);
92 if(Super::GetOwner()!=
nullptr)
93 TraceParams.AddIgnoredActor(Super::GetOwner());
101 FCollisionObjectQueryParams TraceChannel = FCollisionObjectQueryParams(
102 FCollisionObjectQueryParams::AllDynamicObjects);
103 isHitReturned = CurrentWorld->SweepSingleByObjectType(
116 ECollisionChannel TraceChannel = ECC_WorldStatic;
117 isHitReturned = CurrentWorld->SweepSingleByChannel(
137 const FHitResult &Hit)
139 if ((Actor !=
nullptr) && (OtherActor !=
nullptr) &&
IsStreamReady())
146 #if defined(WITH_ROS2)
148 if (ROS2->IsEnabled())
150 TRACE_CPUPROFILER_EVENT_SCOPE_STR(
"ROS2 Send");
152 AActor* ParentActor = GetAttachParentActor();
155 FTransform LocalTransformRelativeToParent = GetActorTransform().GetRelativeTransform(ParentActor->GetActorTransform());
156 ROS2->ProcessDataFromObstacleDetection(DataStream.GetSensorType(), StreamId, LocalTransformRelativeToParent, Actor, OtherActor, HitDistance/100.0f,
this);
160 ROS2->ProcessDataFromObstacleDetection(DataStream.GetSensorType(), StreamId, DataStream.GetSensorTransform(), Actor, OtherActor, HitDistance/100.0f,
this);
165 DataStream.SerializeAndSend(*
this,