NewtonCollisionIntersectionTest with compounds

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

NewtonCollisionIntersectionTest with compounds

Postby Bird » Mon Aug 19, 2013 1:23 pm

I can't seem to get NewtonCollisionIntersectionTest to work in my project when one or both of the collision shapes are a compound. It works fine with all other collision shapes I've tried

I tried making a simple demo and it doesn't work either.

Code: Select all
NewtonWorld* const world = scene->GetNewton();

// make a compound from 2 adjacent unit cubes
NewtonCollision* const compound = NewtonCreateCompoundCollision (world, 0);

NewtonCompoundCollisionBeginAddRemove(compound);

dMatrix offsetA (GetIdentityMatrix());
offsetA.m_posit = dVector(.5f,  0.0f, 0.0f);  // shift to +X
NewtonCollision* const collisionA = NewtonCreateBox (world, 1.0f, 1.0f, 1.0f, 0,  &offsetA[0][0]);
NewtonCompoundCollisionAddSubCollision (compound, collisionA);
NewtonDestroyCollision(collisionA);

dMatrix offsetB (GetIdentityMatrix());
offsetB.m_posit = dVector(-0.5f,  0.0f, 0.0f);  // shift to -X
NewtonCollision* const collisionB = NewtonCreateBox (world, 1.0f, 1.0f, 1.0f, 0,  &offsetB[0][0]);
NewtonCompoundCollisionAddSubCollision (compound, collisionB);
NewtonDestroyCollision(collisionB);

NewtonCompoundCollisionEndAddRemove(compound);   

// make a centered unit cube
dMatrix matrixC (GetIdentityMatrix());
NewtonCollision* const collisionC= NewtonCreateBox (world, 1.0f, 1.0f, 1.0f, 0,  &matrixC[0][0]);

// place compound and unit cube  at the origin and test for intersection
dMatrix poseA  (GetIdentityMatrix());
dMatrix poseB  (GetIdentityMatrix());

if( NewtonCollisionIntersectionTest(world,compound, &poseA[0][0], collisionC, &poseB[0][0],0) )
{
   // intersect
}


I stepped through the code in Newton and wonder if the problem is on line 493 in dgNarrowPhaseCollision.cpp
"return (pair.m_contactCount == -1) ? true : false; "

When using a compound, pair.m_contactCount always seems to be the number of sub collision objects in the compound so it will always fail that test. In the above example, pair.m_contactCount is -2.

-Bird
Bird
 
Posts: 623
Joined: Tue Nov 22, 2011 1:27 am

Re: NewtonCollisionIntersectionTest with compounds

Postby Julio Jerez » Mon Aug 19, 2013 1:54 pm

Ok I debug it tonogh. there may be a bug.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionIntersectionTest with compounds

Postby Julio Jerez » Thu Aug 29, 2013 9:09 am

I am looking at this now
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionIntersectionTest with compounds

Postby Julio Jerez » Thu Aug 29, 2013 9:51 am

alright this is fixed now.
Thanks for those bug report, those where big oversight form my part.

you should sync to svn.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionIntersectionTest with compounds

Postby Bird » Thu Aug 29, 2013 10:07 am

Julio Jerez wrote:alright this is fixed now.
Thanks for those bug report, those where big oversight form my part.

you should sync to svn.


I synced and can confirm that both bugs are fixed.

Thank you!

-Bird
Bird
 
Posts: 623
Joined: Tue Nov 22, 2011 1:27 am


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 10 guests

cron