RayCastRawLidar: Added optimization in the tag getter

This commit is contained in:
Daniel Santos-Olivan 2020-07-29 17:40:49 +02:00 committed by DSantosO
parent a67d9732f2
commit d7b1e4a315
1 changed files with 2 additions and 21 deletions

View File

@ -152,25 +152,6 @@ void ARayCastRawLidar::SimulateLidar(const float DeltaTime)
}
}
static ECityObjectLabel GetComponentTag(const FHitResult& HitInfo) {
auto StaticMeshComponent = Cast<UStaticMeshComponent>(HitInfo.Component.Get());
if (StaticMeshComponent) {
return ATagger::GetLabelByPath(StaticMeshComponent->GetStaticMesh());
}else {
auto SkeletalMeshComponent = Cast<USkeletalMeshComponent>(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<uint32_t>(GetComponentTag(HitInfo));
Detection.object_tag = static_cast<uint32_t>(HitInfo.Component->CustomDepthStencilValue);
}
else {
Detection.object_tag = static_cast<uint32_t>(GetComponentTag(HitInfo));
Detection.object_tag = static_cast<uint32_t>(HitInfo.Component->CustomDepthStencilValue);
}
}
else {