Browse Source

Updated documentation

See:
* https://github.com/jrouwe/JoltPhysics/discussions/1226
* https://github.com/jrouwe/JoltPhysics/discussions/1229
Jorrit Rouwe 1 year ago
parent
commit
8187798876
1 changed files with 7 additions and 1 deletions
  1. 7 1
      Jolt/Physics/PhysicsSystem.h

+ 7 - 1
Jolt/Physics/PhysicsSystem.h

@@ -48,7 +48,8 @@ public:
 	void						SetBodyActivationListener(BodyActivationListener *inListener) { mBodyManager.SetBodyActivationListener(inListener); }
 	BodyActivationListener *	GetBodyActivationListener() const							{ return mBodyManager.GetBodyActivationListener(); }
 
-	/// Listener that is notified whenever a contact point between two bodies is added/updated/removed
+	/// Listener that is notified whenever a contact point between two bodies is added/updated/removed.
+	/// You can't change contact listener during PhysicsSystem::Update but it can be changed at any other time.
 	void						SetContactListener(ContactListener *inListener)				{ mContactManager.SetContactListener(inListener); }
 	ContactListener *			GetContactListener() const									{ return mContactManager.GetContactListener(); }
 
@@ -99,6 +100,11 @@ public:
 	Constraints					GetConstraints() const										{ return mConstraintManager.GetConstraints(); }
 
 	/// Optimize the broadphase, needed only if you've added many bodies prior to calling Update() for the first time.
+	/// Don't call this every frame as PhysicsSystem::Update spreads out the same work over multiple frames.
+	/// If you add many bodies through BodyInterface::AddBodiesPrepare/AddBodiesFinalize and if the bodies in a batch are
+	/// in a roughly unoccupied space (e.g. a new level section) then a call to OptimizeBroadPhase is also not needed
+	/// as batch adding creates an efficient bounding volume hierarchy.
+	/// Don't call this function while bodies are being modified from another thread or use the locking BodyInterface to modify bodies.
 	void						OptimizeBroadPhase();
 
 	/// Adds a new step listener