Download

Destructible meshes + physics (well, just Gravity right now..)

so just to get into UE4 (as I’m still a newbie dev in general anyways) I decided to just work on making a simple asteroids- style game in 3D. No real purpose besides keeping the theme- shoot asteroids n have fun, so I can test out various things and see how they work. What I’m running into right now is that attempting to turn on physics makes the mesh bypass the disabled gravity, and if I leave phsyics off as soon as I apply damage to the mesh gravity is applied (I’m guessing physics has been enabled, not sure though).

The physics action of the chunks is fine IMO (after much, um, playtesting. Yup. Lots of playtesting! :stuck_out_tongue: ) but I’d really like to be able to make the mesh respect the gravity settings if possible. Anyone know how to do this, or if its a feature that’s not implemented yet?

That sounds like a bug! I’ll file a report and we’ll try and get to it soon. Sorry for the trouble.

Hi Sivuden,

I tried the setup you described but it worked correctly for me. Just to make sure, what happens if you place a physically simulated object next to the destructible mesh - does it fall to the ground?
Are you setting Global Gravity Set flag to true? Thanks!

Thank you for the quick reply James and Ori. Its still not working for me; all my other objects (mainly just the player right now as I try to figure this out) are physically simulated and gravity is not in effect (which is the way it should be, as the ‘use gravity’ box is unchecked). I just pulled in the static mesh version of the destructible mesh, with simulate physics and other settings the same. With gravity turned on (in the actor’s physics section) it falls, uncheck the gravity box and physics works fine, but with no gravity. So far so good.

Whenever I make a destructible mesh (with anything I’ve tried so far) from these, I’m unable to simulate physics on them without gravity being turned on. (I just did a test with linear drag, and that appears to be inheriting perfectly fine. So it may be just gravity here?)

Additionally, no matter which settings I use on the original mesh, I am unable to define the gravity settings for the chunks. If Physics is turned off and Use Gravity (in physics settings of the actor in the editor or the component in the blueprint I have set up for it) is turned off as well, the mesh will not be affected by gravity-** until** I hit it and apply damage. If I simulate physics and turn off gravity, 1) the original actor is still affected by gravity, and 2) the chunks, when hit, are also still affected by gravity.

The precise setup I went through to repro this is as follows (my apologies for not providing this in the first place! My mistake :frowning: )

Find the Default Shape_Cube provided with UE4.
Right click, create destructible mesh.
double click the resulting Shape_Cube_DM to open the DM editor.
hit “fracture mesh” and save the file, then create a blueprint using said DM.
Open the resulting blueprint, go to the components window.
Go to Physics section with the Destructible Mesh component selected (it should be the only component here)
Select “Simulate Physics” and deselect “Enable Gravity”.

Compile, Save (if wanted) then go back to the editor window.
Drag a copy of the blueprint out, and hit Simulate. The actor you placed will fall, affected by physics and gravity.

Now, return to the blueprint components section. Deselect the “Simulate Physics” box. Compile, and return to editor.
If you hit simulate, the box will not be affected by gravity. However, if you apply damage (I enabled Impact damage to allow it to be hit by the weapon setup I have), the entire object (every chunk) will be immediately affected by gravity. Other physics options seem to work as far as I’ve tested them, as noted above.

Also, if you damage the object while Simulate Physics is active and Gravity is deselected, the object when damaged will still be affected by gravity; other options as said seem to be working.

Next to both of these, when using the appropriate selections on the original static mesh (no destructible mesh) everything works as expected, minus damage + such. With Physics enabled + gravity enabled, the box is affected by gravity and physics appropriately. With Physics enabled + gravity disabled, the box behaves as expected. With both disabled, also as expected (no physics, no gravity).

I am looking for the global gravity flag right now (its not turning up in the documentation :frowning: )

Edit: Found the option under world settings, it was indeed unchecked (likely something I did when first messing around with the project!) Turning it on made things work like a charm, though now there’s some weird initial impulses I’ve got to track down (or leave, its kind of nice to not have to apply them :stuck_out_tongue: )

Hi Sivuden,

I misunderstood your original post :slight_smile:
You are correct in that there is a bug where destructible mesh ignores the Enable Gravity flag. I’ve fixed this and it should be in the upcoming release.
Thanks for letting us know!