Hi:
When I read and use the btBoxBoxDetector I found something may be a problem in the function dBoxBox2 when determin the face-something intersect the code fragment is:
const btScalar *Ra,*Rb,*pa,*pb,*Sa,*Sb;
if (code <= 3) {
Ra = R1;
Rb = R2;
pa = p1;
pb = p2;
Sa = A;
Sb = B;
}
else {
Ra = R2;
Rb = R1;
pa = p2;
pb = p1;
Sa = B;
Sb = A;
}
But since in the "else" case, it swap the first box and second box so the final contact point calculated is actually lie on the first box suface but not lie on the second one, but function "addcontact" need to the point in the second object "pointInWorldB", So I think we should identify this situation when call addContactPoint ,for exampe when the two box are swapped we should calculate the actual contact point lie in boxB use PointinA + normal*penetrate depth before we call addcontact point
Is something wrong in dBoxBox2 function
-
- Posts: 1
- Joined: Tue Mar 02, 2010 1:58 pm
Re: Is something wrong in dBoxBox2 function
I had a lot of strange problems with box-box collision.
My boxes all had this size: height 10.0, width 2.0, length 0.75. It came to a lot of rotation when one box collided with the other at height 5. This was obviously unrealistic behavior. I searched this forum and found this yet unresponded post.
I disabled the else-clause as below and the unrealistic behavior problems were gone:
if (code <= 3) {
Ra = R1;
Rb = R2;
pa = p1;
pb = p2;
Sa = A;
Sb = B;
}
else {
return 0;
Ra = R2;
Rb = R1;
pa = p2;
pb = p1;
Sa = B;
Sb = A;
}
Am I going to face other incorrect collision behaviours now, since I deactivated a part of the collision detection?
Thanks for having a look at this.
My boxes all had this size: height 10.0, width 2.0, length 0.75. It came to a lot of rotation when one box collided with the other at height 5. This was obviously unrealistic behavior. I searched this forum and found this yet unresponded post.
I disabled the else-clause as below and the unrealistic behavior problems were gone:
if (code <= 3) {
Ra = R1;
Rb = R2;
pa = p1;
pb = p2;
Sa = A;
Sb = B;
}
else {
return 0;
Ra = R2;
Rb = R1;
pa = p2;
pb = p1;
Sa = B;
Sb = A;
}
Am I going to face other incorrect collision behaviours now, since I deactivated a part of the collision detection?
Thanks for having a look at this.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Is something wrong in dBoxBox2 function
Some forum topics might slip the attention, so in general it is best to file an issue in the Google issue tracker to be sure.
Someone filed it, so we look into it.
http://code.google.com/p/bullet/issues/detail?id=351
Thanks,
Erwin
Someone filed it, so we look into it.
http://code.google.com/p/bullet/issues/detail?id=351
Thanks,
Erwin