Destructible Instanced Static Mesh Components?
I've been able to make a procedurally generated level using instanced static mesh components (simple blocks). Now I'm trying to allow the player to apply damage to these blocks to blow them up. I know how to do this by creating destructible mesh components, but I can't figure out how I can use a Destructible Mesh instead of a Static Mesh for procedural generation. Is there some workaround so that I can allow my player to destroy my procedurally generated world?
asked Jul 18 '15 at 06:14 PM in Blueprint Scripting
The best way to do destruction for InstancedStaticMeshComponents is to detect when an individual instance has been damaged and then delete individual instances and spawn a destructible actor in its place. That's possible to do in 4.8 but it's a bit clunky.
For line traces or point damage, Hit.Item contains the instance index that was hit.
One issue is that in 4.8 radial TakeDamage doesn't work well with InstancedStaticMeshComponents because it doesn't calculate the damage amount for each instance based on the falloff but rather treats the entire component as a single object.
For 4.9 foliage I made a subclass of HierarchicalInstancedStaticMeshComponent which correctly calculates the damage, and also added some blueprint functions to allow you to find and destroy instances more easily, especially for radial damage.
The first 4.9 preview will be out soon, but the changes are in these commits if you want to have a look sooner:
answered Jul 20 '15 at 03:34 AM
Yes, you can give each block a "Health" Var. When health = 0. Destroy actor / Mesh. Place a DM there and apply damage to it.
But they would need to be a BP. Give it a go, see how you Frame Rate sits.
Here is a quick example of it I did.
answered Jul 19 '15 at 09:52 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here