So I am trying to be able to retrieve all different static meshes placed using the foliage tool. Is it possible to retrieve certain types of foliage/static meshes? Using get components by class retrieves anything in that class so every single mesh placed in that class instance. Is it possible to have different foliageinstancedstaticmeshcomponent classes? Or how to get them by the right index… I tried looking for tags for those meshes but it seems you can only set tags for actors? Anything else I could think of? Just something to be able to treat them separately. I am a bit lost with this and I don’t probably fully understand how things work. Let me know if that wasn’t clear enough.
Yes, you can create your own foliage spawner as well. When you linetrace, there’s a **Hit Item **output that will give you the specific index of the item that’s part of that InstancedStaticMeshComponent. You can use this to fetch more info from within the **FoliageInstancedStaticMeshComponent **class like the transform and the have the ability to remove it too. I’m assuming you want to swap out an instance with an actual blueprint here? May I ask exactly what you’re trying to do?
Hey thanks for the tip. I am already doing this but instead I am using some collision. The problem comes when I want to put back that exact instance.
Edit: It seems I got at least something going on by getting the object name from the instancedstaticmeshcomponent. Not sure if this is the best way though.
I forgot to mention what I wanted to do. Yeah I am trying to swap instances with blueprints and back to instances again. The problem comes when I try to access different instances containing several static meshes as for now I am a little bit confused on how the internal indexes work. How to store every element independently so they can get retrieved properly without mixing them up.
No worries it seems I got it working how I wanted even though it might not be the cleanest solution, it will do for now.
If you figured it out there’s no need, otherwise you could try
http://mosthostla.com/gamedev/dynofoliage
I am happy with my results so far but it is good to know the existence of that plugin. Thanks for sharing man.
After the upcoming jam I’ll be working again on it to expand it to procedural foliage and create a save system.
It’s not the only marketplace plugin to do it btw. I’m sure.