.. include:: definitions.rstinc .. _materials-label: ========= 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. .. figure:: images/materials/material_context_menu.jpg :alt: The AGX part of the Content Browser right-click menu. :target: _images/material_context_menu.jpg The AGX part of the Content Browser's 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. .. figure:: images/materials/materials_shape_material.jpg :alt: Details panel for a Shape Material. :target: _images/materials_shape_material.jpg Details panel for a Shape Material Shape Materials are assigned to Shapes in the AGX Shape section of the Shape's Details panel. .. figure:: images/materials/materials_shape_material_on_shape.jpg :alt: Assigning a Shape Material to a Shape. :target: _images/materials_shape_material_on_shape.jpg Shape Materials are assigned to a Shape in 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. .. figure:: images/materials/materials_contact_material.jpg :alt: Details panel for a Contact Material :target: _images/materials_contact_material.jpg Details panel for a Contact Material. Terrain Materials are covered in :ref:`terrain-material-label`. 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. **************** Material Library **************** There are several built in Shape and Contact Material assets that come with |AGXUnreal|. 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 |AGXUnreal|. .. figure:: images/materials/material_library_sm.jpg :alt: Built in Shape Materials. :target: _images/material_library_sm.jpg Built in Shape Materials. If these materials are not visible, see :ref:`show-plugin-content-option-label`. The Material library assets are automatically created the first time an Unreal Editor project using |AGXUnreal| 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 |AGXUnreal| can be updated by clicking the ``Refresh Material Libraries`` button in the ``AGX Dynamics Tools Mode``. .. figure:: images/editor/refresh_material_libraries_button.jpg :alt: Refresh Material libraries. :target: _images/refresh_material_libraries_button.jpg 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.