PxMaterial

Defined in include/PxMaterial.h

class PxMaterial : public PxBaseMaterial

Material class to represent a set of surface properties.

See also

PxPhysics.createMaterial

Public Functions

virtual void setDynamicFriction(PxReal coef) = 0

Sets the coefficient of dynamic friction.

The coefficient of dynamic friction should be in [0, PX_MAX_F32). If set to greater than staticFriction, the effective value of staticFriction will be increased to match.

Sleeping: Does NOT wake any actors which may be affected.

See also

getDynamicFriction()

Parameters

coef[in] Coefficient of dynamic friction. Range: [0, PX_MAX_F32)

virtual PxReal getDynamicFriction() const = 0

Retrieves the DynamicFriction value.

See also

setDynamicFriction

Returns

The coefficient of dynamic friction.

virtual void setStaticFriction(PxReal coef) = 0

Sets the coefficient of static friction.

The coefficient of static friction should be in the range [0, PX_MAX_F32)

Sleeping: Does NOT wake any actors which may be affected.

See also

getStaticFriction()

Parameters

coef[in] Coefficient of static friction. Range: [0, PX_MAX_F32)

virtual PxReal getStaticFriction() const = 0

Retrieves the coefficient of static friction.

See also

setStaticFriction

Returns

The coefficient of static friction.

virtual void setRestitution(PxReal rest) = 0

Sets the coefficient of restitution or the spring stiffness for compliant contact.

A coefficient of 0 makes the object bounce as little as possible, higher values up to 1.0 result in more bounce. If a negative value is provided it is interpreted as stiffness term for an implicit spring simulated at the contact site, with the spring positional error defined by the contact separation value. Higher stiffness terms produce stiffer springs that behave more like a rigid contact.

Sleeping: Does NOT wake any actors which may be affected.

See also

getRestitution() setDamping()

Parameters

rest[in] Coefficient of restitution / negative spring stiffness Range: (-INF,1]

virtual PxReal getRestitution() const = 0

Retrieves the coefficient of restitution.

See setRestitution.

See also

setRestitution()

Returns

The coefficient of restitution.

virtual void setDamping(PxReal damping) = 0

Sets the coefficient of damping.

This property only affects the simulation if compliant contact mode is enabled, i.e., a negative restitution value is set. Damping works together with spring stiffness. Spring stiffness corrects positional error while damping resists relative velocity. Setting a high damping coefficient can produce spongy contacts.

Sleeping: Does NOT wake any actors which may be affected.

See also

getDamping()

Parameters

damping[in] Coefficient of damping. Range: [0,INF)

virtual PxReal getDamping() const = 0

Retrieves the coefficient of damping.

See setDamping.

See also

setDamping()

Returns

The coefficient of damping.

virtual void setFlag(PxMaterialFlag::Enum flag, bool b) = 0

Raises or clears a particular material flag.

See the list of flags PxMaterialFlag

Default: eIMPROVED_PATCH_FRICTION

Sleeping: Does NOT wake any actors which may be affected.

See also

getFlags() setFlags() PxMaterialFlag

Parameters
  • flag[in] The PxMaterial flag to raise(set) or clear.

  • b[in] New state of the flag

virtual void setFlags(PxMaterialFlags flags) = 0

sets all the material flags.

See the list of flags PxMaterialFlag

Default: eIMPROVED_PATCH_FRICTION

Sleeping: Does NOT wake any actors which may be affected.

See also

getFlags() setFlag() PxMaterialFlag

Parameters

flags[in] All PxMaterial flags

virtual PxMaterialFlags getFlags() const = 0

Retrieves the flags.

See PxMaterialFlag.

See also

PxMaterialFlag setFlags()

Returns

The material flags.

virtual void setFrictionCombineMode(PxCombineMode::Enum combMode) = 0

Sets the friction combine mode.

See the enum PxCombineMode .

Default: PxCombineMode::eAVERAGE

Sleeping: Does NOT wake any actors which may be affected.

See also

PxCombineMode getFrictionCombineMode setStaticFriction() setDynamicFriction()

Parameters

combMode[in] Friction combine mode to set for this material. See PxCombineMode.

virtual PxCombineMode::Enum getFrictionCombineMode() const = 0

Retrieves the friction combine mode.

See setFrictionCombineMode.

See also

PxCombineMode setFrictionCombineMode()

Returns

The friction combine mode for this material.

virtual void setRestitutionCombineMode(PxCombineMode::Enum combMode) = 0

Sets the restitution combine mode.

See the enum PxCombineMode .

Default: PxCombineMode::eAVERAGE

Sleeping: Does NOT wake any actors which may be affected.

See also

PxCombineMode getRestitutionCombineMode() setRestitution()

Parameters

combMode[in] Restitution combine mode for this material. See PxCombineMode.

virtual PxCombineMode::Enum getRestitutionCombineMode() const = 0

Retrieves the restitution combine mode.

See setRestitutionCombineMode.

See also

PxCombineMode setRestitutionCombineMode getRestitution()

Returns

The coefficient of restitution combine mode for this material.

virtual void setDampingCombineMode(PxCombineMode::Enum combMode) = 0

Sets the damping combine mode.

See the enum PxCombineMode .

Default: PxCombineMode::eAVERAGE

Sleeping: Does NOT wake any actors which may be affected.

See also

PxCombineMode getDampingCombineMode() setDamping()

Parameters

combMode[in] Damping combine mode for this material. See PxCombineMode.

virtual PxCombineMode::Enum getDampingCombineMode() const = 0

Retrieves the damping combine mode.

See also

PxCombineMode setDampingCombineMode() getDamping()

Returns

The damping combine mode for this material.

inline virtual const char *getConcreteTypeName() const final override

Returns string name of dynamic type.

Returns

Class name of most derived type of this object.

virtual void release() = 0

Decrements the reference count of the object and releases it if the new reference count is zero.

virtual PxU32 getReferenceCount() const = 0

Returns the reference count of the object.

At creation, the reference count of the object is 1. Every other object referencing this object increments the count by 1. When the reference count reaches 0, and only then, the object gets destroyed automatically.

Returns

the current reference count.

virtual void acquireReference() = 0

Acquires a counted reference to this object.

This method increases the reference count of the object by 1. Decrement the reference count by calling release()

template<class T>
inline T *is()
template<class T>
inline const T *is() const
inline PxType getConcreteType() const

Returns concrete type of object.

See also

PxConcreteType

Returns

PxConcreteType::Enum of serialized object

inline void setBaseFlag(PxBaseFlag::Enum flag, bool value)

Set PxBaseFlag

Parameters
  • flag[in] The flag to be set

  • value[in] The flags new value

inline void setBaseFlags(PxBaseFlags inFlags)

Set PxBaseFlags

See also

PxBaseFlags

Parameters

inFlags[in] The flags to be set

inline PxBaseFlags getBaseFlags() const

Returns PxBaseFlags.

See also

PxBaseFlags

Returns

PxBaseFlags

inline virtual bool isReleasable() const

Whether the object is subordinate.

A class is subordinate, if it can only be instantiated in the context of another class.

See also

PxSerialization::isSerializable

Returns

Whether the class is subordinate

Public Members

void *userData

user can assign this to whatever, usually to create a 1:1 relationship with a user object.

Protected Functions

inline PxMaterial(PxType concreteType, PxBaseFlags baseFlags)
inline PxMaterial(PxBaseFlags baseFlags)
inline virtual ~PxMaterial()
inline virtual bool isKindOf(const char *name) const

Returns whether a given type name matches with the type of this instance.

inline virtual void onRefCountZero()
template<class T>
inline bool typeMatch() const

Protected Attributes

PxType mConcreteType
PxBaseFlags mBaseFlags
PxU32 mBuiltInRefCount