I have a Blueprint that creates instanced static meshes in the construction script. That works fine, but I cannot then add foliage on top of my instanced static meshes using the Foliage tool in the editor.
How can I add foliage to my Instanced Static Mesh components?
Foliage can only be placed on objects that have their collision object type set to World Static. To place foliage on Instanced Static Mesh Components, you need to call Set Collision Object Type with channel set to WorldStatic:
When deciding where foliage can be placed, the editor calls a function named AInstancedFoliageActor::FoliageTrace
which performs a sweep test:
InWorld->SweepMultiByObjectType(Hits, StartTrace, DesiredInstance.EndTrace, FQuat::Identity, FCollisionObjectQueryParams(ECC_WorldStatic), SphereShape, QueryParams);
ECC_WorldStatic
is the C++ constant for WorldStatic in Blueprints.
1 Like