Report any bugs here and we'll post fixes
Moderators: Sascha Willems, Thomas
by arkeon » Sun Sep 21, 2014 6:03 am
Hello,
Maybe it's a normal behavior, but in dgBroadPhase::FindCollidingPairsGeneric a contact is detected inside a collision tree even if the body do not touch the faces.
when I say inside a collision tree I mean a mesh like a house for example.
-
arkeon
-
- Posts: 261
- Joined: Sat Sep 13, 2014 5:25 pm
by manny » Sun Sep 21, 2014 6:08 am
that's probably intended as it's party of the AABB of that collision shape.
a broadphase is only performing a really coarse search to find potentially intersecting shapes.
you would probably have to split up your house into different walls if you don't want it to be triggered in the broadphase. depending on the complexity of your house and the amount of bodies inside it, it might be worth it.
-
manny
- Site Admin
-
- Posts: 131
- Joined: Tue Feb 11, 2014 6:49 pm
by arkeon » Sun Sep 21, 2014 6:11 am
Ok thanks, so contacts joint are only detected by AABB detection ?
-
arkeon
-
- Posts: 261
- Joined: Sat Sep 13, 2014 5:25 pm
by manny » Sun Sep 21, 2014 6:15 am
arkeon wrote:Ok thanks, so contacts joint are only detected by AABB detection ?
I don't think I understand your question, but do you mean "colliding pairs"?
both phases normally generate colliding pairs, the broadphase AND the narrow phase.
the idea is that the colliding pairs by the broadphase are not completly detailed yet, just contain that a potential intersection between body A+B might occur. in the narrow phase invalid pairs are deleted or the details are filled out by the detailde shape vs shape collision.
EDIT: ah, you refer to contact information for joints. yes, I think those are also filled out during the narrowphase. check out dgWorld::CalculateContacts
-
manny
- Site Admin
-
- Posts: 131
- Joined: Tue Feb 11, 2014 6:49 pm
by arkeon » Sun Sep 21, 2014 6:20 am
yes in fact in my code a collision pair is detected inside the collision tree when the body do not touch it.
- Code: Select all
NewtonBody* b0 = nbody0->getNewtonBody();
NewtonBody* b1 = nbody1->getNewtonBody();
NewtonJoint* contactJoint = NewtonBodyGetFirstContactJoint(b0);
while((contactJoint) && (!bodiesInContact))
{
// Get infos about the bodies of contact from Newton
NewtonBody* b0Bis = NewtonJointGetBody0(contactJoint);
NewtonBody* b1Bis = NewtonJointGetBody1(contactJoint);
int colstate = NewtonJointGetCollisionState(contactJoint);
// Is the body still in contact with the second body of the pair value?
if(colstate && ((b0Bis == b0)&&(b1Bis == b1)) || ((b0Bis == b1)&&(b1Bis == b0)))
bodiesInContact = true;
else
contactJoint = NewtonBodyGetNextContactJoint(b0, contactJoint);
}
-
arkeon
-
- Posts: 261
- Joined: Sat Sep 13, 2014 5:25 pm
by manny » Sun Sep 21, 2014 6:22 am
maybe the issue is related to a scaled collision shape?
-
manny
- Site Admin
-
- Posts: 131
- Joined: Tue Feb 11, 2014 6:49 pm
by arkeon » Sun Sep 21, 2014 6:23 am
Yes it was my first through too. this collision tree is scaled.
-
arkeon
-
- Posts: 261
- Joined: Sat Sep 13, 2014 5:25 pm
by manny » Sun Sep 21, 2014 6:24 am
arkeon wrote:Yes it was my first through too. this collision tree is scaled.
also don't forget about floating point issues if your shapes are too small
EDIT: might be a bug then, scaled collisions are nasty
-
manny
- Site Admin
-
- Posts: 131
- Joined: Tue Feb 11, 2014 6:49 pm
by arkeon » Sun Sep 21, 2014 6:26 am
it must still some forgotten cases with scaling
But I think this is the last one.
-
arkeon
-
- Posts: 261
- Joined: Sat Sep 13, 2014 5:25 pm
by manny » Sun Sep 21, 2014 6:29 am
arkeon wrote:it must still some forgotten cases with scaling
But I think this is the last one.
just so we know it's the scaling, can you reproduce the issue if you remove all scalings from any shapes in your scene?
-
manny
- Site Admin
-
- Posts: 131
- Joined: Tue Feb 11, 2014 6:49 pm
by arkeon » Sun Sep 21, 2014 6:30 am
Yes I'll do that. I added a define for that last time
-
arkeon
-
- Posts: 261
- Joined: Sat Sep 13, 2014 5:25 pm
by arkeon » Sun Sep 21, 2014 6:40 am
Hmm no seems to be the same with no scaling.
-
arkeon
-
- Posts: 261
- Joined: Sat Sep 13, 2014 5:25 pm
by manny » Sun Sep 21, 2014 6:43 am
arkeon wrote:Hmm no seems to be the same with no scaling.
maybe there is no valid contact for that contactjoint, can you iterate through the contacts with: NewtonContactJointGetFirstContact,
you can then also dump out detailed info:
- Code: Select all
dVector point;
dVector normal;
dVector dir0;
dVector dir1;
dVector force;
NewtonMaterial* const material = NewtonContactGetMaterial (contact);
NewtonMaterialGetContactForce (material, body, &force.m_x);
NewtonMaterialGetContactPositionAndNormal (material, body, &point.m_x, &normal.m_x);
NewtonMaterialGetContactTangentDirections (material, body, &dir0.m_x, &dir1.m_x);
if there is a valid point (s), try to visualize it with your renderer and post a screenshot.
-
manny
- Site Admin
-
- Posts: 131
- Joined: Tue Feb 11, 2014 6:49 pm
by arkeon » Sun Sep 21, 2014 6:45 am
This is what I do, and a contact joint the the building is found, when it should not.
I'll try without continuous collision on the main body.
-
arkeon
-
- Posts: 261
- Joined: Sat Sep 13, 2014 5:25 pm
by manny » Sun Sep 21, 2014 6:46 am
arkeon wrote:This is what I do, and a contact joint the the building is found, when it should not.
I'll try without continuous collision on the main body.
no, you iterate through the contact joints but not the contacts for a contact joint!
pseude code:
- Code: Select all
for each ContactJoint in Body
for each Contact in ContactJoint
visualize and dump info
-
manny
- Site Admin
-
- Posts: 131
- Joined: Tue Feb 11, 2014 6:49 pm
Return to Bugs and Fixes
Who is online
Users browsing this forum: No registered users and 7 guests