Open 3D Engine PhysX Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
PhysX::Material Class Reference

#include <PhysXMaterial.h>

Inherits Physics::Material, AZStd::enable_shared_from_this< Material >, and AZ::Data::AssetBus::Handler.

Public Member Functions

 AZ_CLASS_ALLOCATOR (Material, AZ::SystemAllocator)
 
 AZ_RTTI (PhysX::Material, "{57A9681F-4025-4D66-891B-80CBC78BDEB9}", Physics::Material)
 
Physics::MaterialPropertyValue GetProperty (AZStd::string_view propertyName) const override
 
void SetProperty (AZStd::string_view propertyName, Physics::MaterialPropertyValue value) override
 
float GetDynamicFriction () const
 
void SetDynamicFriction (float dynamicFriction)
 
float GetStaticFriction () const
 
void SetStaticFriction (float staticFriction)
 
float GetRestitution () const
 
void SetRestitution (float restitution)
 
CombineMode GetFrictionCombineMode () const
 
void SetFrictionCombineMode (CombineMode mode)
 
CombineMode GetRestitutionCombineMode () const
 
void SetRestitutionCombineMode (CombineMode mode)
 
float GetDensity () const
 
void SetDensity (float density)
 
bool IsCompliantContactModeEnabled () const
 
void EnableCompliantContactMode (bool enabled)
 
float GetCompliantContactModeDamping () const
 
void SetCompliantContactModeDamping (float damping)
 
float GetCompliantContactModeStiffness () const
 
void SetCompliantContactModeStiffness (float stiffness)
 
const AZ::Color & GetDebugColor () const
 
void SetDebugColor (const AZ::Color &debugColor)
 
const physx::PxMaterial * GetPxMaterial () const
 

Static Public Member Functions

static AZStd::shared_ptr< MaterialFindOrCreateMaterial (const AZ::Data::Asset< Physics::MaterialAsset > &materialAsset)
 
static AZStd::vector< AZStd::shared_ptr< Material > > FindOrCreateMaterials (const Physics::MaterialSlots &materialSlots)
 
static AZStd::shared_ptr< MaterialCreateMaterialWithRandomId (const AZ::Data::Asset< Physics::MaterialAsset > &materialAsset)
 

Protected Member Functions

void OnAssetReady (AZ::Data::Asset< AZ::Data::AssetData > asset) override
 
void OnAssetReloaded (AZ::Data::Asset< AZ::Data::AssetData > asset) override
 

Friends

class MaterialManager
 

Detailed Description

Runtime PhysX material instance. It handles the reloading of its data if the material asset it was created from is modified. It also provides functions to create PhysX materials.

Member Function Documentation

◆ CreateMaterialWithRandomId()

static AZStd::shared_ptr< Material > PhysX::Material::CreateMaterialWithRandomId ( const AZ::Data::Asset< Physics::MaterialAsset > &  materialAsset)
static

Function to create a material instance from an asset. A random material will be used. This function is useful to create several instances from the same asset.

Parameters
materialAssetMaterial asset to create the material instance from.
Returns
Material instance created. It can return nullptr if the creation failed or if the asset passed is invalid.

◆ FindOrCreateMaterial()

static AZStd::shared_ptr< Material > PhysX::Material::FindOrCreateMaterial ( const AZ::Data::Asset< Physics::MaterialAsset > &  materialAsset)
static

Function to create a material instance from an asset. The material id will be constructed from the asset id. If the material id is found in the manager it returns the existing material instance.

Parameters
materialAssetMaterial asset to create the material instance from.
Returns
Material instance created or found. It can return nullptr if the creation failed or if the asset passed is invalid.

◆ FindOrCreateMaterials()

static AZStd::vector< AZStd::shared_ptr< Material > > PhysX::Material::FindOrCreateMaterials ( const Physics::MaterialSlots &  materialSlots)
static

Function to create material instances from material slots. The material ids will be constructed from the asset ids of the assets assigned to the slots. It will always return a valid list of materials, the slots with invalid or no assets will have the default material instance.

Parameters
materialSlotsMaterial slots with the list of material assets to create the material instances from.
Returns
List of material instances created. It will always return a valid list.

The documentation for this class was generated from the following file: