From d7b1e4a3156493e042f1b5de9c739c67f41500e9 Mon Sep 17 00:00:00 2001 From: Daniel Santos-Olivan Date: Wed, 29 Jul 2020 17:40:49 +0200 Subject: [PATCH] RayCastRawLidar: Added optimization in the tag getter --- .../Source/Carla/Sensor/RayCastRawLidar.cpp | 23 ++----------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/RayCastRawLidar.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/RayCastRawLidar.cpp index a8adde26a..7bca126a1 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/RayCastRawLidar.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/RayCastRawLidar.cpp @@ -152,25 +152,6 @@ void ARayCastRawLidar::SimulateLidar(const float DeltaTime) } } -static ECityObjectLabel GetComponentTag(const FHitResult& HitInfo) { - auto StaticMeshComponent = Cast(HitInfo.Component.Get()); - - if (StaticMeshComponent) { - return ATagger::GetLabelByPath(StaticMeshComponent->GetStaticMesh()); - }else { - auto SkeletalMeshComponent = Cast(HitInfo.Component.Get()); - if (SkeletalMeshComponent) { - return ATagger::GetLabelByPath(SkeletalMeshComponent->GetPhysicsAsset()); - } - else { - return ECityObjectLabel::None; - } - } - - -} - - void ARayCastRawLidar::ComputeRawDetection(const FHitResult& HitInfo, const FTransform& SensorTransf, FRawDetection& Detection) const { const FVector HitPoint = HitInfo.ImpactPoint; @@ -192,10 +173,10 @@ void ARayCastRawLidar::ComputeRawDetection(const FHitResult& HitInfo, const FTra const FActorInfo* ActorInfo = view.GetActorInfo(); Detection.object_idx = ActorInfo->Description.UId; - Detection.object_tag = static_cast(GetComponentTag(HitInfo)); + Detection.object_tag = static_cast(HitInfo.Component->CustomDepthStencilValue); } else { - Detection.object_tag = static_cast(GetComponentTag(HitInfo)); + Detection.object_tag = static_cast(HitInfo.Component->CustomDepthStencilValue); } } else {