Gradually destroying a blueprint based on health, script review request

Hi, Im just looking for someone who is more knowledgable than I (so probably everyone on here) to just take a quick look at this script and just let me know if this is the best way of doing it (for optimization and/or any other reason) and if not point me in the right direction. Be Fore-warned this is the first script in any form i have EVER written myself. totally open to suggestions here.

I made the effect i wanted in max and threw out a quick render, this is what im aiming for -

Im still trying to figure out how to export the animation correctly from 3ds max so i can fake the physics rather than have them computed every time. so any advice/links to tutorials on that would also be appreciated. Is there any way to do it other than rigging and skinning it???

The basic idea is that the tree will degrade as it is harvested, I havent put a weapon on the main character so i’ve just set it up for when hitting anything to test it. My game character currently has a very bad headache. :slight_smile:

Just as a side note, i know i could reuse the TreeHealth var and TreeAll mesh nodes but this just looked nicer to my OCDesc brain :smiley:

really appreciate any help you can offer, thanks in advance.

Am i asking a really stupid question here? If i am please let me know. Im totally new to this and any feedback is good feedback. :slight_smile:

For destroying the trunk, use a destructible mesh ( Ue will fracture mesh for you, just google )

To gradually hide the leaves - there are many different options.

Your approach of using transparent materials should work - using a Switch On Int node will clean it up.

Thanks for the reply monkey. I have already used DMs for the tree but what i was thinking was that if it was precalculated then it would use less system resources rather than calculating physics for each individual destruction (there is potentially going to be hundreds of them in each level). I already have it animated in max as you can see and was thinking of just bringing that over to UE4. If there is a way to cache the animation in UE4 though thats an equally viable solution.

Will use the switch on int, thanks, I appreciate the help.

Cool - the other benefit of using the destructible mesh is that the pieces fall different everytime rather than playing the exact same animation… looks less scripted