The following is a quick guide on getting a PhysX* Destructible Mesh (DM) working setup in an Unreal Engine* 4 (UE4*) project.
This guide is primarily based on personal trial and error; other methods may exist that work better for your project. See official documentation for tutorials on fracturing and troubleshooting if you would like to go more in depth with Destructive Mesh capabilities.
To get started, download and install PhysX Lab. Version 1.3.2 was used for this paper.
Whether made in Blender*, Maya*, or other modeling software, set the modeling units to meters, or scale up the model so it is the correct size before exporting. If the model comes into UE4 too small, it will need to scale up in the project, which can lead to errors in mesh collision. In general, avoid changing the scale of a DM in UE4, but if needed, scaling down works better than scaling up.
For the purposes of this paper, once the FBX* file is imported into the lab, go ahead and click theFracture! button in the bottom right-hand corner. To learn more about this feature, see the tutorials onfracturing.
You can go back and play with the fracture settings after getting the more important parts set up, so don’t feel like you have to get the perfect fracture just yet.
For a DM to have two different textures (outside and inside), follow these steps in the Control Panel (Figure 1):
1. Under the Graphics tab, and in the Material Library tab, find the green/white lambert texture.
2. Right-click the lambert and load the texture as a material.
3. Select a BMP or Targa file for the mesh.
4. Select the new texture in the Material Library tab, then under the Mesh Materials tab, click the Apply(black) arrow.
5. Now, under the Select Interior Material tab select the lambert and then click the Set Interior Material of Selected button. (You may see this result after applying the mesh material; this is recommend to make sure it takes on export.)
6. Set the U Scale and V Scale to 100.
Figure 1. Graphics tab in the Control Panel.
Now, for the DM, it’s time to play with some settings (Figure 2). As with the textures, these settings can be played with after the DM has been imported into UE4. It was found that turning settings on in the lab increases the chances of them working as intended when exported. These settings are:
- Debris Depth
- Use Lifetime Range
- Use Debris Depth
- Destruction Probability (This cannot be changed in UE; chance of chunk being destroyed when hit)
- Support Depth
- Asset Defined Support
- World Overlap
Figure 2. Assets tab in the Control Panel.
Once finished with the settings and the fracture has been set, use Export Asset to export and move the DM to UE4.
Bringing a DM into UE4 is as easy as any other asset; use the Import button in the Content Browser. If the FBX file was set up correctly, the DM can be dragged into the scene.
Depending on the mechanics of your game, a few physics settings should be considered (Figure 3):
- Simulate Physics
- A False setting is for things like walls and stationary objects.
- A True setting will cause the mesh to fall (unless gravity is off).
- Enable Gravity
- When Simulate Physics is False (the default setting for most DMs), True makes it so a DM doesn’t fall to gravity, but broken chunks will still be affected by gravity.
- A False setting will cause the DM and its chunks to float around in space.
- Use Async Scene
- If True, the DM will not collide with any other physics actor.
- If False, the DM can collide with other physics actors.
Figure 3. Physics panel.
If the DM is intended to break by falling to the ground or being run into, check the Enable Impact Damage option window (Figure 4). Changing the Impact Resistance changes the amount of force pushed back into the actor that the DM collides with.
Figure 4. Destructible Setting tab.
For more such intel resources and tools from Intel on Game, please visit the Intel® Game Developer Zone
Other Popular Deals
- The 10 best job hunting apps on AndroidTop 10 Android launchers (June 2017)
- The 10 scariest horror games on AndroidAndroid app stores: 5 best alternatives to Google Play Store
- Best Android apps for rooted devices18 apps for a memorable Valentine's Day
- Top 15 Android games that you should playThe 20 best looking games for mobile phones
- 8 Android apps to tickle your funny bone17 must have apps for any Android device (plus alternatives)
- 5 apps to get the Android Lollipop look on your smartphoneTake control of your Android device with these apps
- 7 weird and strange apps for your Smartphone10 neat Google apps you may not know of
- Perfect Viewer10 essential Indian apps for Android devices