Skip to content

Commit

Permalink
Added some documentation cross references for manifold reduction
Browse files Browse the repository at this point in the history
  • Loading branch information
jrouwe committed Dec 3, 2023
1 parent 01725e9 commit 6531b3d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Jolt/Physics/Body/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ class alignas(JPH_RVECTOR_ALIGNMENT) JPH_EXPORT_GCC_BUG_WORKAROUND Body : public
/// Check if this sensor detects static objects entering it.
inline bool SensorDetectsStatic() const { return (mFlags.load(memory_order_relaxed) & uint8(EFlags::SensorDetectsStatic)) != 0; }

/// If PhysicsSettings::mUseManifoldReduction is true, this allows turning off manifold reduction for this specific body. Manifold reduction by default will combine contacts that come from different SubShapeIDs (e.g. different triangles or different compound shapes).
/// If PhysicsSettings::mUseManifoldReduction is true, this allows turning off manifold reduction for this specific body.
/// Manifold reduction by default will combine contacts with similar normals that come from different SubShapeIDs (e.g. different triangles in a mesh shape or different compound shapes).
/// If the application requires tracking exactly which SubShapeIDs are in contact, you can turn off manifold reduction. Note that this comes at a performance cost.
inline void SetUseManifoldReduction(bool inUseReduction) { JPH_ASSERT(IsRigidBody()); if (inUseReduction) mFlags.fetch_or(uint8(EFlags::UseManifoldReduction), memory_order_relaxed); else mFlags.fetch_and(uint8(~uint8(EFlags::UseManifoldReduction)), memory_order_relaxed); }

Expand Down
2 changes: 1 addition & 1 deletion Jolt/Physics/Collision/ContactListener.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ContactManifold
RVec3 mBaseOffset; ///< Offset to which all the contact points are relative
Vec3 mWorldSpaceNormal; ///< Normal for this manifold, direction along which to move body 2 out of collision along the shortest path
float mPenetrationDepth; ///< Penetration depth (move shape 2 by this distance to resolve the collision)
SubShapeID mSubShapeID1; ///< Sub shapes that formed this manifold (note that when multiple manifolds are combined because they're coplanar, we lose some information here because we only keep track of one sub shape pair that we encounter)
SubShapeID mSubShapeID1; ///< Sub shapes that formed this manifold (note that when multiple manifolds are combined because they're coplanar, we lose some information here because we only keep track of one sub shape pair that we encounter, see description at Body::SetUseManifoldReduction)
SubShapeID mSubShapeID2;
ContactPoints mRelativeContactPointsOn1; ///< Contact points on the surface of shape 1 relative to mBaseOffset.
ContactPoints mRelativeContactPointsOn2; ///< Contact points on the surface of shape 2 relative to mBaseOffset. If there's no penetration, this will be the same as mRelativeContactPointsOn1. If there is penetration they will be different.
Expand Down
2 changes: 1 addition & 1 deletion Jolt/Physics/PhysicsSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ struct PhysicsSettings
/// Whether or not to use the body pair cache, which removes the need for narrow phase collision detection when orientation between two bodies didn't change
bool mUseBodyPairContactCache = true;

/// Whether or not to reduce manifolds with similar contact normals into one contact manifold
/// Whether or not to reduce manifolds with similar contact normals into one contact manifold (see description at Body::SetUseManifoldReduction)
bool mUseManifoldReduction = true;

/// If we split up large islands into smaller parallel batches of work (to improve performance)
Expand Down

0 comments on commit 6531b3d

Please sign in to comment.