RayCastSemanticLidar: Fix id problem

We were getting the id from ActorInfo and this one
it is not the same as the client's actor id.
Now, we take it from FActorView and it is the correct one.
This commit is contained in:
Daniel Santos-Olivan 2020-10-05 17:35:40 +02:00 committed by Marc Garcia Puig
parent 784d9b9ffe
commit 49e5ef05a7
1 changed files with 4 additions and 10 deletions

View File

@ -162,20 +162,14 @@ void ARayCastSemanticLidar::ComputeRawDetection(const FHitResult& HitInfo, const
AActor* actor = HitInfo.Actor.Get();
Detection.object_idx = 0;
Detection.object_tag = static_cast<uint32_t>(crp::CityObjectLabel::None);
Detection.object_tag = static_cast<uint32_t>(HitInfo.Component->CustomDepthStencilValue);
if (actor != nullptr) {
Detection.object_tag = static_cast<uint32_t>(crp::CityObjectLabel::None);
FActorView view = Registry.Find(actor);
if(view.IsValid()) {
if(view.IsValid())
const FActorInfo* ActorInfo = view.GetActorInfo();
Detection.object_idx = ActorInfo->Description.UId;
Detection.object_tag = static_cast<uint32_t>(HitInfo.Component->CustomDepthStencilValue);
}
else {
Detection.object_tag = static_cast<uint32_t>(HitInfo.Component->CustomDepthStencilValue);
}
}
else {
UE_LOG(LogCarla, Warning, TEXT("Actor not valid %p!!!!"), actor);