Open simon-lgb opened 3 weeks ago
Hey @simon-lgb,
thanks for the issue. You are right, disabling the object's rigidbody does not disable the rigid bodys of the components. I am not sure there is an easy way to do this automatically.
However, disabling the childrens' rigidbodies manually definitely works:
obj.disable_rigidbody()
for child in obj.get_children():
child.disable_rigidbody()
And for reactivating them again, do:
obj.enable_rigidbody(active=True, collision_shape='COMPOUND')
for child in obj.get_children():
child.enable_rigidbody(True, "CONVEX_HULL")
Thank you for you reply, I ended up settling for a similar solution in my code.
My approach would be to set a custom property on the parts and handle your suggestions above in the method of the parent object. I would also include deleting any previous objects when a new shape is built.
Unless you consider it as too complex for the library, I could create a PR for this. In the former case, may I suggest to add a note about this behavior to the relevant method documentations?
Hey @simon-lgb,
your approach seems good! It would be great if you could create a PR :)
Describe the issue
When convex decomposition parts are built for an object, disabling the rigid body does not properly work anymore. This appears to be due to the created parts objects not being removed or their rigid bodies being disabled. This prevents the physics simulation from terminating once objects stop moving and can significantly impact performance.
Minimal code example
Files required to run the code
No response
Expected behavior
The rigid body parts should either be completely removed (would require rebuilding them if needed again later) or their rigid bodies should be disabled and potentially reenabled later.
BlenderProc version
2.7.1