Physics Material Properties for use with Simulation Engines#
Utility functions to define, apply, and bind physics material properties to collision geometry.
When UsdPhysicsMaterialAPI is applied on a UsdShadeMaterial it specifies various physical properties which should be used during simulation of the bound geometry.
In some cases it may be desirable to manage physics materials separately from visual materials, and in other cases it is useful to manage them as one prim.
The functions below can be used to create a new physics material, to apply physics properties to a visual material, and to bind a physics material to a rigid body or collider.
See UsdPhysicsMaterialAPI for details.
Note
When mixing visual and physical materials, be sure use both usdex::core::bindMaterial and usdex::core::bindPhysicsMaterial on the target geometry, to ensure the material is used in both rendering and simulation contexts.
Functions#
- bool usdex::core::addPhysicsToMaterial(pxr::UsdShadeMaterial &material, const float dynamicFriction, const std::optional< float > staticFriction=std::nullopt, const std::optional< float > restitution=std::nullopt, const std::optional< float > density=std::nullopt)
Adds physical material parameters to an existing Material.
- bool usdex::core::bindPhysicsMaterial(pxr::UsdPrim prim, const pxr::UsdShadeMaterial &material)
Binds a physics material to a given rigid body or collision geometry.
- pxr::UsdShadeMaterial usdex::core::definePhysicsMaterial(pxr::UsdStagePtr stage, const pxr::SdfPath &path, const float dynamicFriction, const std::optional< float > staticFriction=std::nullopt, const std::optional< float > restitution=std::nullopt, const std::optional< float > density=std::nullopt)
Creates a Physics Material.
- pxr::UsdShadeMaterial usdex::core::definePhysicsMaterial(pxr::UsdPrim parent, const std::string &name, const float dynamicFriction, const std::optional< float > staticFriction=std::nullopt, const std::optional< float > restitution=std::nullopt, const std::optional< float > density=std::nullopt)
Creates a Physics Material.
- pxr::UsdShadeMaterial usdex::core::definePhysicsMaterial(pxr::UsdPrim prim, const float dynamicFriction, const std::optional< float > staticFriction=std::nullopt, const std::optional< float > restitution=std::nullopt, const std::optional< float > density=std::nullopt)
Creates a Physics Material.