removeBody leaves rigid-body constraints pointing at the deleted body
Environment
- OS: Ubuntu 24.04.5 LTS, Linux 7.0.0-28-generic x86_64
- Compiler: GCC 11.5.0
- Python: 3.12.3
- Source:
bulletphysics/bullet3masterat63c4d67e337017f9d8b298c900e9aabdb69296e7 - PyBullet: built locally from that exact checkout
Description
Removing a maximal-coordinate rigid body does not remove btTypedConstraint objects or m_userConstraints entries that reference it. The multibody branch performs this cleanup, but the rigid-body branch deletes the body after a //todo: clear all other remaining data... comment.
Expected behavior: removeBody removes constraints whose endpoint is the removed body, just as the multibody path does.
Actual behavior: stepping immediately after removal exits with status 139. If a replacement rigid body is allocated first, the retained fixed constraint silently binds the replacement: a body created at x=5 moves to x=4.5 and its peer moves from x=1 to x=1.5. Removing the constraint before the body is a clean control and leaves both positions unchanged.
Reproduction package:
rigid-body-removal-constraint-cleanup-poc.zip
Steps to reproduce
- Build PyBullet from the commit above using
poc/README.md. - Run the
control,dangling, andreusemodes in separate processes. - Compare the exit statuses, constraint counts, and positions with
poc/observed-output.txt.
Source: bulletphysics/bullet3