i've noticed some strange behavior while updating the angle limits of revolute joints after their initial creation. i'm making the assumption that since there is an API for changing the limit enabled / limit angles after the joint has been created that this is a valid use case but please correct me if i'm wrong. here are the repro steps:
1. create a revolute joint connecting 2 bodies without an angle limit enabled.
2. over time, move the bodies so that the joint's angle is non-zero
3. enable the limit for the joint and set the angle limit to something close to 0.0 so that the current angle violates the limit
4. during the few ticks in which box2d is applying an impulse to try to correct the angle to bring it back within the limit, disable the limit
what happens is the impulse that was correcting the joint angle is never reset and the joint will continue trying to spin as if a motor were enabled. (the actual motor is never enabled during any of this.) i've been able to correct this by manually setting b2RevoluteJoint::m_impulse.z to 0.0 when i disable the limit in step 4. is this a bug or am i doing something that is off limits? we only encountered the issue as a consequence of being able to tune our joint parameters in real time for our game so we won't actually need to do this once we're finished with development.
thanks!
1. create a revolute joint connecting 2 bodies without an angle limit enabled.
2. over time, move the bodies so that the joint's angle is non-zero
3. enable the limit for the joint and set the angle limit to something close to 0.0 so that the current angle violates the limit
4. during the few ticks in which box2d is applying an impulse to try to correct the angle to bring it back within the limit, disable the limit
what happens is the impulse that was correcting the joint angle is never reset and the joint will continue trying to spin as if a motor were enabled. (the actual motor is never enabled during any of this.) i've been able to correct this by manually setting b2RevoluteJoint::m_impulse.z to 0.0 when i disable the limit in step 4. is this a bug or am i doing something that is off limits? we only encountered the issue as a consequence of being able to tune our joint parameters in real time for our game so we won't actually need to do this once we're finished with development.
thanks!