NewtonCollisionClosestPoint() and compound shapes

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

NewtonCollisionClosestPoint() and compound shapes

Postby Bird » Fri Mar 28, 2014 2:23 pm

Hi Julio,

When painting I use NewtonCollisionClosestPoint() to help to set the user defined gap between instances. But it wouldn't work with Compound shapes like those created with NewtonMeshApproximateConvexDecomposition() because of there's a dgAssert(0) on line 435 of dgNarrowPhaseCollision.cpp.

Any chance you could fix that?

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

Re: NewtonCollisionClosestPoint() and compound shapes

Postby Julio Jerez » Fri Mar 28, 2014 3:03 pm

Oh yes I did no implemnt
bool dgCollisionConvex::CalculateClosestPoints (dgCollisionParamProxy& proxy) const
for compound yet, teh code is ter commnete out,

I will make funtional tomorrow, it is no that diffcult.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionClosestPoint() and compound shapes

Postby Bird » Fri Mar 28, 2014 3:26 pm

I will make funtional tomorrow, it is no that diffcult.


Great! Thanks

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

Re: NewtonCollisionClosestPoint() and compound shapes

Postby Bird » Tue Apr 01, 2014 2:15 pm

Julio Jerez wrote:Oh yes I did no implemnt
bool dgCollisionConvex::CalculateClosestPoints (dgCollisionParamProxy& proxy) const
for compound yet, teh code is ter commnete out,

I will make funtional tomorrow, it is no that diffcult.


Hi Julio,

Do you think you will be able implement this? The actual line is 465 of dgNarrowPhaseCollision.cpp, not 435 like I said previously in error.

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

Re: NewtonCollisionClosestPoint() and compound shapes

Postby Julio Jerez » Wed Apr 02, 2014 2:49 pm

yes, I will, thsi is actaully part of the SDK API, I just did no have tiem to write iot.

I did not do last weekend, I will try this next one, it is actaully very simple to do it.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionClosestPoint() and compound shapes

Postby Bird » Tue Apr 08, 2014 11:01 am

I did not do last weekend, I will try this next one, it is actaully very simple to do it.


Hi Julio,

Sorry to keep bugging you about but it's kind of a big problem for my project.

And did you ever get the chance to try to handle this problem? http://newtondynamics.com/forum/viewtopic.php?f=9&t=8579

I'd love to be able to do completely intersection free painting if possible. :)

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

Re: NewtonCollisionClosestPoint() and compound shapes

Postby Bird » Fri Aug 22, 2014 9:57 am

Hi Julio,

Any chance you can take a look at this? I need to be able to paint with Compound Shapes and this is a showstopper for me. Thanks -Bird
Bird
 
Posts: 636
Joined: Tue Nov 22, 2011 1:27 am

Re: NewtonCollisionClosestPoint() and compound shapes

Postby Julio Jerez » Fri Aug 22, 2014 4:19 pm

Is this the same a the problem with the long skinny box?

Oh I see the closest point on compound is no implemented in the engine core.
OK let us do this, I will do the long skinny box bug, and add the compound closest point for compound tomorrow.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionClosestPoint() and compound shapes

Postby Bird » Fri Aug 22, 2014 4:37 pm

OK let us do this, I will do the long skinny box bug, and add the compound closest point for compound tomorrow.

Excellent. Thanks!

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

Re: NewtonCollisionClosestPoint() and compound shapes

Postby Bird » Fri Aug 29, 2014 1:07 pm

OK let us do this, I will do the long skinny box bug, and add the compound closest point for compound tomorrow.


Any luck? :)

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

Re: NewtonCollisionClosestPoint() and compound shapes

Postby Julio Jerez » Fri Aug 29, 2014 7:53 pm

Ok I am doing this now.
but I am a lite confused here.
the function that is commented out is this
Code: Select all
dgInt32 dgWorld::ClosestPoint(const dgCollisionInstance* const collisionSrcA, const dgMatrix& matrixA,
                       const dgCollisionInstance* const collisionSrcB, const dgMatrix& matrixB,
                       dgTriplex& contactA, dgTriplex& contactB, dgTriplex& normalAB,dgInt32 threadIndex)
{
   dgKinematicBody collideBodyA;
   dgKinematicBody collideBodyB;
   dgContactPoint contacts[DG_MAX_CONTATCS];

   dgCollisionInstance collisionA(*collisionSrcA, collisionSrcA->GetChildShape());
   dgCollisionInstance collisionB(*collisionSrcB, collisionSrcB->GetChildShape());

   collideBodyA.m_matrix = matrixA;
   collideBodyA.m_collision = &collisionA;
   collisionA.SetGlobalMatrix(collisionA.GetLocalMatrix() * matrixA);

   collideBodyB.m_matrix = matrixB;
   collideBodyB.m_collision = &collisionB;
   collisionB.SetGlobalMatrix (collisionB.GetLocalMatrix() * matrixB);


   dgContactMaterial material;
   material.m_penetration = dgFloat32 (0.0f);

   dgContact contactJoint (this, &material);
   contactJoint.SetBodies (&collideBodyA, &collideBodyB);

   dgCollisionParamProxy proxy(&contactJoint, contacts, threadIndex, false, false);

   if (collisionA.IsType (dgCollision::dgCollisionCompound_RTTI)) {
      dgAssert (0);
/*
      return ClosestCompoundPoint (&collideBodyA, &collideBodyB, contactA, contactB, normalAB, threadIndex);
   } else if (collisionB.IsType (dgCollision::dgCollisionCompound_RTTI)) {
      dgInt32 flag = ClosestCompoundPoint (&collideBodyB, &collideBodyA, contactB, contactA, normalAB, threadIndex);
      normalAB.m_x *= dgFloat32 (-1.0f);
      normalAB.m_y *= dgFloat32 (-1.0f);
      normalAB.m_z *= dgFloat32 (-1.0f);
      return flag;
*/



can you verified that this is where you are getting the assert? I do no remember the convex cast using that function.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionClosestPoint() and compound shapes

Postby AntonSynytsia » Fri Aug 29, 2014 9:42 pm

Just in case it wasn't mentioned, closest distance doesn't work with tree and compound collisions. Although it does work with all convex shapes, i.e. cylinders, cones, spheres, and convex hull itself.
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: NewtonCollisionClosestPoint() and compound shapes

Postby Bird » Fri Aug 29, 2014 10:05 pm

can you verified that this is where you are getting the assert? I do no remember the convex cast using that function


This is a separate issue from convex cast. When I'm painting I use NewtonCollisionClosestPoint() to allow the user to set a gap between instances so when the user is painting with compound shapes that;s when I'm hitting the assert.

Thanks taking the time to look into this!

On another note, have you ever looked at DLib? ( I just discovered it) http://dlib.net/ Looks extremely well done with lots of goodies that you might find useful for Newton.

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

Re: NewtonCollisionClosestPoint() and compound shapes

Postby Julio Jerez » Sat Aug 30, 2014 1:30 am

Ok now you have compound/convex and compound/compound

@ AntonSynytsia
the closest distance does not support closest distance to collision trees, or heightfield, do you nee that?.
It does support compound collision as they are consideredd convex.

@Bird
Sync again, and tell me how it goes.
tomorrow I will do the long shape placement. Is that working fine?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionClosestPoint() and compound shapes

Postby AntonSynytsia » Sat Aug 30, 2014 4:30 am

@Juleo
No, I think I won't need that for tree collisions. I was just testing.
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron