12. Materials
Materials define the way Rigid Bodies interact when in contact. This is a type of material separate from the rendering materials that are an integral part of Unreal Engine. Materials are Assets, which means that they are created and edited in the Content Browser. You can find them in the AGX part of the right-click menu.
There are three main types of materials: Shape Material, Contact Material and Terrain Material. The Shape Material is applied to a Shape Component to assign properties such as density, Young’s Modulus, and roughness to it.
Shape Materials are assigned to Shapes in the AGX Shape section of the Shape’s Details panel.
Contact Materials define contact related properties such as friction coefficient and restitution, but also simulation engine related settings such as the type of solver to use, contact reduction parameters, and the friction model. A Contact Material is created for a pair of Shape materials so that when two Shapes having these materials come into contact then this particular Contact Material is used.
Terrain Materials are covered in Terrain Material.
Just as with other types of assets, simply creating a Contact Material asset does not instantiate it within the level. We must add it to a Component that exists within the level and the type of Component to use for this is the Contact Material Registrar. It has a Contact Materials property that is a list of Contact Materials to which we add the Contact Materials. These are automatically added to the simulation at play.
12.1. Material Library
There are several built in Shape and Contact Material assets that come with AGX Dynamics for Unreal.
Built in Shape Materials are located in AGXUnreal/Content/Shape/ShapeMaterialLibrary
.
Built in Contact Materials are located in AGXUnreal/Content/Shape/ContactMaterialLibrary
.
Built in Terrain Materials are located in AGXUnreal/Content/Terrain/TerrainMaterialLibrary
.
These can be used directly or as a starting point when setting up physics models in AGX Dynamics for Unreal.
If these materials are not visible, see AGX Dynamics for Unreal content not showing.
The Material library assets are automatically created the first time an Unreal Editor project using AGX Dynamics for Unreal is started.
They are created from the .json files of the Material library in AGX Dynamics, see AGX Dynamics User Manual.
If Material definitions (.json) have been added or changed, the Material library assets in AGX Dynamics for Unreal can be updated by clicking the Refresh Material Libraries
button in the AGX Dynamics Tools Mode
.
Note that it is recommended to only have a single instance of the Unreal Editor running when performing this action.