bullet3
bullet3 copied to clipboard
[DRAFT] Fix processInitPoseCommand: must update Aabbs after resetting body pose
Closes #2881 I found that the reason why this probelm occurs. This is becaues after resetting the pose of the body Aabbs are not updated. I tested the error case (collision is not detected thought it supposed to) mentioned in #2881, and checked that collision is detected after this commit.
I found this bug when compare the behavior of inside btDbvt::rayTestInternal method when I change parameter of code in #2881 as follows:
result = test_smallsphere([0.0, 0, 0.000]) # case A
result = test_smallsphere([0.0, 0, 0.1]) # case B
I noticed that when case B, btRayAabb2 here returns false although it should not so. I further found that node->volume.Mins() and node->volume.Maxs() in here do not change after p.resetBasePositionAndOrientation(ss, pos, [0, 0, 0, 1]) is called. Then, I fixed this bug.
Thanks. It is best to just update a single AABB, using the
world->updateSingleAabb(colObj);
@erwincoumans is there any reason not to pull this, or is it being solved somewhere else? I ran into the same issue with pybullet today.
@cadop Probably, my not responding is the reason why this PR is not pulled. @erwincoumans I am sorry that I didn't respond to
It is best to just update a single AABB, using the
world->updateSingleAabb(colObj);
6 month ago, I attempted to interpret this comment for couple of hours, but I couldn't. it would be nice you make a new PR to fix this problem
so I wasn't sure if this is intended behavior for some reason, or actually a bug. Since I was using pybullet: for myself, I would rather spend the time to expose the C function to updateAABB in the python interface as a method to be called by users if they manually move an object, but this is also an interface design decision.
Here is a suggested fix that automatically updates the AABB when using 'resetBasePositionAndOrientation' and 'resetJointState': https://github.com/bulletphysics/bullet3/pull/3311/commits/0196edd4d2e0cde2de5c8138d5f69df2cea9fce4
Exposing a 'performDiscreteCollisionDetection' would be useful too (it would update all aabb's as well as computing contact points, without running a full stepSimulation with forward dynamics, and collision response etc).