Hi,
I encountered an issue while working with InstancedFoliageActor in Unreal Engine 5.6.1.
[Situation]
This issue does not occur in Landscape or Foliage Edit mode.
It happens after the level (with World Partition) is loaded and Waiting for texture resource to be ready for landscape
[Issue]
When reading data from a Landscape HeightMap (via FLandscapeEditLayerComponentReadbackResult), ULandscapeHeightfieldCollisionComponent::SnapFoliageInstances is called
However, the ULandscapeHeightfieldCollisionComponent objects (corresponding to the Readback) and the foliage mesh instances become continuously misaligned.
As a result, the InstancedFoliageActor packages remain dirty even after resaving
ULandscapeHeightfieldCollisionComponent::SnapFoliageInstances(const FBox& InInstanceBox)
{
UWorld* ComponentWorld = GetWorld();
for (TActorIterator<AInstancedFoliageActor> It(ComponentWorld); It; ++It)
{
AInstancedFoliageActor* IFA = *It;
...
World->LineTraceMultiByObjectType(Results, Start, End, FCollisionObjectQueryParams(ECollisionChannel::ECC_Visibility), FCollisionQueryParams(SCENE_QUERY_STAT(FoliageSnapToLandscape), true));
bool bFoundHit = false;
for (const FHitResult& Hit : Results)
{
if (Hit.Component == this)
{
bFoundHit = true;
if ((InstanceLocation - Hit.Location).SizeSquared() > KINDA_SMALL_NUMBER)
{
IFA->Modify();
...
}
[Example values]
Instance.Location = {X=-126063.43248945594, Y=-10394.36923343333, Z=-4634.915273624938}
Hit.Location = {X=-126063.43248945594, Y=-10394.36923343333, Z=-4635.4142105467618}
(InstanceLocation - Hit.Location).SizeSquared() ≈ 0.24894
KINDA_SMALL_NUMBER = 1.e-4f ≈ 0.0001f
Among 8,542 foliage instances, about 89 (≈1%) exceed a distance of 1 unit, resulting in constant dirty states.
[Desired]
It seems necessary to adjust the tolerance value or avoid unnecessary instance updates when the positional difference is within an acceptable floating-point error range
Thank you in advance.