Skip to content

Commit 3a6aa41

Browse files
committed
Improved docs of Space.remove
1 parent ce26585 commit 3a6aa41

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

pymunk/space.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,19 @@ def add(self, *objs: _AddableObjects) -> None:
377377
def remove(self, *objs: _AddableObjects) -> None:
378378
"""Remove one or many shapes, bodies or constraints from the space
379379
380-
Unlike Chipmunk and earlier versions of Pymunk its now allowed to
381-
remove objects even from a callback during the simulation step.
382-
However, the removal will not be performed until the end of the step.
380+
Unlike Chipmunk and early versions of Pymunk its allowed to
381+
remove objects from a collision callback.
382+
383+
There are two cases, the most common is that a collision callback is
384+
invoked during a Space.step() simulation step. In this case the
385+
removal will happen in the end of the step(), when all callbacks have
386+
been called and the collisions resolved.
387+
388+
A more uncommon case is when the `separate` callback is triggered by
389+
calling Space.remove() outside of the step() function, and another
390+
remove is called from the `seprate()` callback. In this case the
391+
second removal will happen at the end of the first call to
392+
Space.remove(), when all `separate` callbacks have been called.
383393
384394
.. Note::
385395
When removing objects from the space, make sure you remove any

0 commit comments

Comments
 (0)