Interact with foliage at run-time (Cut down trees, remove foliage, etc...)

Yep it was colliding with the volume hence why actor -> procedural whatever class was working. Thanks. Although the traces went through the “air” of the volume and still hit the foilage mesh i just got an index of -1.

Collission is fine for foilage types. Thats gotta be it regardless is its hitting the volume. The little things you never think about thanks.

Yeah, when testing your problem, I dragged in my spawner, and set it’s collision to block all, when it wasn’t working, I traced the hit component and saw that it is a brush, so I disabled collision & it worked, glad I could help.

Thank you for a VERY informative and helpful tutorial! Going to make use of this in my game & I’m sure alot of others will as well :stuck_out_tongue:

PS: Just saw this and it made me a very happy man!

I am glad you enjoyed it, be sure to subscribe to receive notifications of my new tutorials.

This is amazing!!

Thank-you, I’m glad you enjoyed, be sure to subscribe to my channel for notifications of my new tutorials. I am quite surprised that I am the first one to make a tutorial like this seeing as UE4 has been out for ~18 months now.

Umad bruh?

You got the right post Bruh?

Rofl… You just made my day.

Hey do anyone have any experience with this for multiplayer.
It seems to me that the instance ID (Hit Item) is difrent for every client.
Makes it hard to replicate.

It won’t work with the landscape grass which is spawned by material.

In that case, you’d need to run the trace on each client and have them remove the foliage instance.

I tired several ways, with no luck so far.
I have encounterd a bug where the second connected player(s) not removing the instance.
Will suddenly apear under the map, and server failes at updating position/ movement.

Some more testing did however indicate that instances are the same on server and client(s).
Also attempted to set the foliage actor and component to be replicated at runtime but did not help ether.

EDIT: I got it to replicated as intended, if anyone is intrested the logic is as follows.
1 Trace from Local Player, check for hits.
2 If client hits foliage, trace from hit.TraceStart to hit.TraceEnd server side and check hits.
3 If we hit the foliage call RPC (NetMulticast) for removing instance.

Thank you for this; it helped a lot

I’m glad it helped you :slight_smile:

Hi, I know this is an old thread, hopefully someone still looks at it… I seem to be having an issue doing this with instances placed with the procedural foliage tool, how are you guys removing the instance when spawning the BP? I seem to not be able to do so, I have no issues removing the instanced mesh of a painted foliage using the editor tool.


Hi there!

Seeing DistrictWave didn’t get an answer made me lose hope a bit in getting one myself :'D

I made a TreeBase actor and my trees receive damage until they are at 0 HP, then I active physics simulation and apply a force so it looks like they are falling (which does work pretty nicely). Problem is now that I tried using them as actor foliage, it has an immense hit on performance once I reach > 1,000 tree actors (which I was expecting, but I am lazy and just hoped for a better result).

Now foliage has some performance optimization, do you think it would be enough in this case? Even when expecting 3,000 trees or even more plus other foliage I might want to show?
If so, how would you suggest to deal with the logic? As I said, my tree actors receive damage and fall when they reach 0. I guess damage would not be a possibility anymore, but how would I implement having to hit it multiple times (other than simulating it via a repeating animation and replacing it with the actor once the animation is done).

Also if I wanted to let’s say make trees grow (either scaling them or even replacing the meshes) and make trees spawn next to other trees, how would go about that?

I also wrote an answerhub post, but I didn’t get any feedback as of now: Actor foliage performance - UE4 AnswerHub

Thanks and cheers!