Fixed bug on BB to Comp conversion
This commit is contained in:
parent
7e42db5ab2
commit
6b27c8226f
|
@ -608,23 +608,27 @@ void UBoundingBoxCalculator::GetMeshCompsFromActorBoundingBox(
|
|||
{
|
||||
check(Actor);
|
||||
|
||||
TArray<FBoundingBox> BBsOfTL;
|
||||
TArray<uint8> InternalOutTags;
|
||||
TArray<UStaticMeshComponent*> StaticMeshComps;
|
||||
Actor->GetComponents<UStaticMeshComponent>(StaticMeshComps);
|
||||
GetBBsOfStaticMeshComponents(StaticMeshComps, BBsOfTL, InternalOutTags);
|
||||
check(BBsOfTL.Num() == InternalOutTags.Num());
|
||||
|
||||
const float DistanceThreshold = 100.0f * 100.0f;
|
||||
|
||||
for(int i = 0; i < BBsOfTL.Num(); i++)
|
||||
TArray<UStaticMeshComponent*> SMComps;
|
||||
Actor->GetComponents<UStaticMeshComponent>(SMComps);
|
||||
|
||||
for(UStaticMeshComponent* Comp : SMComps)
|
||||
{
|
||||
const FBoundingBox& BB = BBsOfTL[i];
|
||||
if(!Comp->IsVisible()) continue;
|
||||
|
||||
TArray<FBoundingBox> BBs;
|
||||
TArray<uint8> InternalOutTags;
|
||||
GetBBsOfStaticMeshComponents({Comp}, BBs, InternalOutTags);
|
||||
|
||||
if(BBs.Num() == 0) continue;
|
||||
|
||||
const FBoundingBox& BB = BBs[0];
|
||||
float Distance = FVector::DistSquared(InBB.Origin, BB.Origin);
|
||||
if(Distance <= DistanceThreshold)
|
||||
{
|
||||
OutStaticMeshComps.Emplace(StaticMeshComps[i]);
|
||||
OutStaticMeshComps.Emplace(Comp);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,6 @@ void UObjectRegister::RegisterObjects(TArray<AActor*> Actors)
|
|||
|
||||
for(AActor* Actor : Actors)
|
||||
{
|
||||
const FString ActorName = Actor->GetName();
|
||||
|
||||
FString ClassName = Actor->GetClass()->GetName();
|
||||
// Discard Sky to not break the global ilumination
|
||||
|
@ -104,13 +103,24 @@ void UObjectRegister::RegisterObjects(TArray<AActor*> Actors)
|
|||
|
||||
void UObjectRegister::EnableEnvironmentObjects(const TSet<uint64>& EnvObjectIds, bool Enable)
|
||||
{
|
||||
for(FEnvironmentObject& EnvironmentObject : EnvironmentObjects)
|
||||
for(uint64 It : EnvObjectIds)
|
||||
{
|
||||
if(EnvObjectIds.Contains(EnvironmentObject.Id))
|
||||
bool found = false;
|
||||
for(FEnvironmentObject& EnvironmentObject : EnvironmentObjects)
|
||||
{
|
||||
EnableEnvironmentObject(EnvironmentObject, Enable);
|
||||
if(It == EnvironmentObject.Id)
|
||||
{
|
||||
EnableEnvironmentObject(EnvironmentObject, Enable);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found)
|
||||
{
|
||||
UE_LOG(LogCarla, Error, TEXT("EnableEnvironmentObjects id not found %llu"), It);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void UObjectRegister::RegisterEnvironmentObject(
|
||||
|
@ -405,4 +415,4 @@ void UObjectRegister::EnableISMComp(FEnvironmentObject& EnvironmentObject, bool
|
|||
UInstancedStaticMeshComponent* ISMComp = Cast<UInstancedStaticMeshComponent>(SMComp);
|
||||
bool Result = ISMComp->UpdateInstanceTransform(Index, InstanceTransform, true, true);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue