How to remove a body/shape/constraint from pymunk space without exceptions
In Pymunk, I can call the .remove() method of a Space to remove bodies, shapes and/or constraints from it. However, it will raise an error if the object doesn't exist in the space (e.g. was already removed). Example: import pymunk space = pymunk.Space() body = pymunk.Body() space.add(body) space.remove(body) space.remove(body) # call it again On the second .remove() call, I get: Traceback (most recent call last): File "c:\Users\CHU0094\Downloads\x\main.py", line 7, in <module> space.remove(body) File "C:\Program Files\Python310\lib\site-packages\pymunk\space.py", line 401, in remove self._remo
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.