Download

Spawned object do not break destructible mesh

Hello. I make prototype where you can throw object similar to angry birds mechanic.

Situation is following:

  • I have Sphere actor, blueprint. If I place it at level, then start level, throw it to destructible cube, cube breaks, particle system starts
  • I created blueprint script at Level blueprint and at Sphere blueprint: when press N, spawn actor from class Sphere blueprint
  • Then if I press during gameplay, actor is spawned, but when I throw it at destructible cube, cube DOES NOT BREAK, but particle system still starts.

So hit event logic works ok. If I just drag blueprint from content browser to scene and don’t make any changes, everyting works fine. If I spawn sphere during the game, something weird happens and the cube can’t be broken by this spawned sphere.

Why this can happen?

Thanks a lot in advance

So after some tries I figured out this somehow part of this script becomes not working
80cef8ee66590052377003fb36014b847be0df38.jpeg

Here on hit, I compare color IDs of the sphere and cube. If they equal, cube destroyed and its particle system becomes visible and blinking. If color IDs don’t match, I change material of the cube to white, just for testing, and assign color ID of the ball, so the next one will be able to destroy it.
By default, destructible cube mesh doesn’t receive impact damage, so I give damage and impulse after hit. Everything works when you place sphere blueprint actor on the scene and start to play.

BUT, when you spawn new actor from Sphere class from Level blueprint and hit it to cube, particle system starts blinking, but cube remains intact. It seems that this Apply Damage doesn’t work for spawned actors. Any reasons why it can happen?

And another strangest thing, if I spawn sphere from level using BeginPlay event, everything works :slight_smile: but when you use same script, same nodes by pressing button during the game, sphere spawns and after hitting cube, cube doesn’t brake. HOW this can happen?