Foliage usually follows when the Transform of the placed ground or floor changes. However, if the ground or floor is a Level Instance Actor, it will not follow.
The cause is in the code below.
void AInstancedFoliageActor::OnLevelActorMoved(AActor* InActor) { UWorld* InWorld = InActor->GetWorld(); if (!InWorld || !InWorld->IsGameWorld()) { for (UActorComponent* Component : InActor->GetComponents()) { if (Component) { MoveInstancesForMovedComponent(Component); } } ... } void AInstancedFoliageActor::MoveInstancesForMovedComponent(UActorComponent* InComponent) { ... const auto BaseId = InstanceBaseCache.GetInstanceBaseId(InComponent); if (BaseId == FFoliageInstanceBaseCache::InvalidBaseId) { return; } ...
Instance of Foliage has the information of the placed Component. This component is a component of the Actor in LevelInstance. But since the Component of LevelInstanceActor itself is used in the check of the tracking process, the tracking process is not executed.
To solve this, you need to save the RootComponent of LevelInstanceActor in Instance like following code.
Engine\Source\Editor\FoliageEdit\Private\FoliageEdMode.cpp // add #include "LevelInstance/LevelInstanceSubsystem.h" #include "LevelInstance/LevelInstanceActor.h" // bool FEdModeFoliage::AddInstancesImp(UWorld* InWorld, const UFoliageType* Settings, const TArray<FDesiredFoliageInstance>& DesiredInstances, const TArray<int32>& ExistingInstanceBuckets, const float Pressure, LandscapeLayerCacheData* LandscapeLayerCachesPtr, const FFoliageUISettings* UISettings, const FFoliagePaintingGeometryFilter* OverrideGeometryFilter, bool InRebuildFoliageTree) { ... { SCOPE_CYCLE_COUNTER(STAT_FoliageSpawnInstance); TArray<FFoliageInstance> PlacedInstances; PlacedInstances.Reserve(AdditionalInstances); // add ULevelInstanceSubsystem* LevelInstanceSubsystem = InWorld->GetSubsystem<ULevelInstanceSubsystem>(); ///// for (int32 Idx = 0; Idx < AdditionalInstances; Idx++) { FPotentialInstance& PotentialInstance = PotentialInstances[Idx]; FFoliageInstance Inst; if (PotentialInstance.PlaceInstance(InWorld, Settings, Inst)) { Inst.ProceduralGuid = PotentialInstance.DesiredInstance.ProceduralGuid; Inst.BaseComponent = PotentialInstance.HitComponent; // add if (LevelInstanceSubsystem) { ALevelInstance* LevelInstanceActor = LevelInstanceSubsystem->GetParentLevelInstance(Inst.BaseComponent->GetOwner()); if (LevelInstanceActor) { Inst.BaseComponent = LevelInstanceActor->GetRootComponent(); } } ///// PlacedInstances.Add(MoveTemp(Inst)); bPlacedInstances = true; } } SpawnFoliageInstance(InWorld, Settings, UISettings, PlacedInstances, InRebuildFoliageTree); } } return bPlacedInstances; }
expect : Foliage follow 3
result : foliage does not follow 3. Therefore, foliage and 3 appear to be separated
i have this problem UE4CC-Windows-58DC12AF4B97F057BD108FBFF569B2E9_0000
I am not able to find world outliner how to enable it?
How can i modify the param name in EQS node
How to achieve HLSL Multiple Render Target in Material blueprints?
An error occurred while trying to generate project files !?
What method is used to fill polygonal regions when drawing spline mesh at run time?
Undefined sysmbol: typeinfo for AActor when cross-compile linux dedicated server on windows
Delay nodes occasionally don't fire the "Completed" output in a nativized build
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-157536 in the post.
3 |
Component | UE - World Creation - Worldbuilding Tools - Foliage |
---|---|
Affects Versions | 5.0 |
Target Fix | 5.6 |
Created | Jun 24, 2022 |
---|---|
Updated | Oct 11, 2024 |