diff options
| author | Sheikh Dawood Abdul Ajees <[email protected]> | 2017-09-15 15:41:57 -0500 |
|---|---|---|
| committer | Sheikh Dawood Abdul Ajees <[email protected]> | 2017-09-15 15:41:57 -0500 |
| commit | d1c812f1162e5fdb13c215792725b2591d7428f5 (patch) | |
| tree | 407056c45c7e9320c48fca6a3697d81a061c4ea0 /PhysX_3.4/Include/PxContactModifyCallback.h | |
| parent | PhysX 3.4, APEX 1.4 patch release @22121272 (diff) | |
| download | physx-3.4-d1c812f1162e5fdb13c215792725b2591d7428f5.tar.xz physx-3.4-d1c812f1162e5fdb13c215792725b2591d7428f5.zip | |
PhysX 3.4.1, APEX 1.4.1 Release @22845541v3.4.1
Diffstat (limited to 'PhysX_3.4/Include/PxContactModifyCallback.h')
| -rw-r--r-- | PhysX_3.4/Include/PxContactModifyCallback.h | 69 |
1 files changed, 68 insertions, 1 deletions
diff --git a/PhysX_3.4/Include/PxContactModifyCallback.h b/PhysX_3.4/Include/PxContactModifyCallback.h index 324257de..bae6c0fe 100644 --- a/PhysX_3.4/Include/PxContactModifyCallback.h +++ b/PhysX_3.4/Include/PxContactModifyCallback.h @@ -142,7 +142,15 @@ public: @see PxModifiableContact.internalFaceIndex1 */ - PX_FORCE_INLINE PxU32 getInternalFaceIndex1(PxU32 i) { PX_UNUSED(i); return PXC_CONTACT_NO_FACE_INDEX; } + PX_FORCE_INLINE PxU32 getInternalFaceIndex1(PxU32 i) + { + PxContactPatch* patch = getPatch(); + if (patch->internalFlags & PxContactPatch::eHAS_FACE_INDICES) + { + return reinterpret_cast<PxU32*>(mContacts + mCount)[mCount + i]; + } + return PXC_CONTACT_NO_FACE_INDEX; + } /** \brief Get the maximum impulse for a specific contact point in the set. @@ -166,6 +174,65 @@ public: } /** + \brief Get the restitution coefficient for a specific contact point in the set. + + @see PxModifiableContact.restitution + */ + PX_FORCE_INLINE PxReal getRestitution(PxU32 i) const { return mContacts[i].restitution; } + + /** + \brief Alter the restitution coefficient for a specific contact point in the set. + + \note Valid ranges [0,1] + + @see PxModifiableContact.restitution + */ + PX_FORCE_INLINE void setRestitution(PxU32 i, PxReal r) + { + PxContactPatch* patch = getPatch(); + patch->internalFlags |= PxContactPatch::eREGENERATE_PATCHES; + mContacts[i].restitution = r; + } + + /** + \brief Get the static friction coefficient for a specific contact point in the set. + + @see PxModifiableContact.staticFriction + */ + PX_FORCE_INLINE PxReal getStaticFriction(PxU32 i) const { return mContacts[i].staticFriction; } + + /** + \brief Alter the static friction coefficient for a specific contact point in the set. + + @see PxModifiableContact.staticFriction + */ + PX_FORCE_INLINE void setStaticFriction(PxU32 i, PxReal f) + { + PxContactPatch* patch = getPatch(); + patch->internalFlags |= PxContactPatch::eREGENERATE_PATCHES; + mContacts[i].staticFriction = f; + } + + /** + \brief Get the static friction coefficient for a specific contact point in the set. + + @see PxModifiableContact.dynamicFriction + */ + PX_FORCE_INLINE PxReal getDynamicFriction(PxU32 i) const { return mContacts[i].dynamicFriction; } + + /** + \brief Alter the static dynamic coefficient for a specific contact point in the set. + + @see PxModifiableContact.dynamic + */ + PX_FORCE_INLINE void setDynamicFriction(PxU32 i, PxReal f) + { + PxContactPatch* patch = getPatch(); + patch->internalFlags |= PxContactPatch::eREGENERATE_PATCHES; + mContacts[i].dynamicFriction = f; + } + + /** \brief Ignore the contact point. If a contact point is ignored then no force will get applied at this point. This can be used to disable collision in certain areas of a shape, for example. |