Convex Stacks VS Box Stacks (3.12)

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Convex Stacks VS Box Stacks (3.12)

Postby AntonSynytsia » Tue Jun 17, 2014 6:37 pm

I did a test of convex collision stacks vs box stacks (on my wrapper) and found that box collision stacks don't work the same as convex collision stacks. The update step in the demonstrations below are 1/60.0 seconds.

Convex Stacks:
Image

Box Stacks:
Image

Is this behavior intentional?

I don't have any problems fixing this. To prevent the penetration I can either enable continuous collision or set update step to 1/240.0 seconds, for instance. I'm just wondering whether or not this is a bug. :?

Details:
  • In this examples I used default material settings and avoided setting material collision callbacks just to minimize the potential for error in my own wrapper.
  • To ensure that the force of gravity is the same I checked the mass of convex and box bodies. The results are same.

BTW: Compound from mesh shapes behave the same way as box stacks. So the convex collision is the unique one, hmm.
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: Convex Stacks VS Box Stacks (3.12)

Postby Julio Jerez » Wed Jun 18, 2014 2:03 pm

it should be the same. Boxes have a special contact collision function. but they should both produce the same outcome.

It is me of are you dropping the boxes form a higher elevation?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Convex Stacks VS Box Stacks (3.12)

Postby AntonSynytsia » Wed Jun 18, 2014 3:52 pm

Julio Jerez wrote:it should be the same. Boxes have a special contact collision function. but they should both produce the same outcome.

It is me of are you dropping the boxes form a higher elevation?

The boxes are dropping from the same height as the convex boxes are. In fact they are stacked so there is no space in between. The question is why they don't behave the same? I will try to add similar to demos sandbox and send a commit.
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: Convex Stacks VS Box Stacks (3.12)

Postby AntonSynytsia » Thu Jun 19, 2014 4:22 am

Ok, I did a test on demos sandbox and it works all properly. It seems my wrapper has some errors...
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: Convex Stacks VS Box Stacks (3.12)

Postby Julio Jerez » Thu Jun 19, 2014 8:04 am

Ha, that was my impression, because aside form that Boxes use a different formation to calculated the support vertex, that the only difference bewteen convex and a box
ther rest is identical.

I was going to give you a function to test, that you can apply and make the Box a convex hull, basically that was to make to the Box class use the conve class funtions
by doing this
Code: Select all
dgVector dgCollisionBox::SupportVertex (const dgVector& dir, dgInt32* const vertexIndex) const
{
return dgConvex::dgCollisionConvex SupportVertex (dir, vertexIndex);

   dgAssert (dir.m_w == dgFloat32 (0.0f));
   dgVector mask (dir < dgVector (dgFloat32 (0.0f)));
   return (m_size[1] & mask) + m_size[0].AndNot(mask);
}


and the same for function
Code: Select all
dgInt32 dgCollisionBox::CalculatePlaneIntersection (const dgVector& normal, const dgVector& point, dgVector* const contactsOut) const


that will make the Box act as a convex hold, because boxes are special case convex hulls. they are just a little faster.
but my guess Is that this is not the problem
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Convex Stacks VS Box Stacks (3.12)

Postby AntonSynytsia » Mon Jun 23, 2014 10:20 pm

I get a bunch of errors by implementing the code above:

4>..\..\..\source\physics\dgCollisionBox.cpp(146): error C2653: 'dgConvex' : is not a class or namespace name
4>..\..\..\source\physics\dgCollisionBox.cpp(146): error C2146: syntax error : missing ';' before identifier 'SupportVertex'
4>..\..\..\source\physics\dgCollisionBox.cpp(146): error C2275: 'dgCollisionConvex' : illegal use of this type as an expression
4>..\..\..\source\physics\dgCollisionBox.cpp(235): error C2653: 'dgConvex' : is not a class or namespace name
4>..\..\..\source\physics\dgCollisionBox.cpp(235): error C2146: syntax error : missing ';' before identifier 'SupportVertex'
4>..\..\..\source\physics\dgCollisionBox.cpp(235): error C2275: 'dgCollisionConvex' : illegal use of this type as an expression
4>..\..\..\source\physics\dgCollisionBox.cpp(235): error C2065: 'dir' : undeclared identifier
4>..\..\..\source\physics\dgCollisionBox.cpp(235): error C2065: 'vertexIndex' : undeclared identifier
4>..\..\..\source\physics\dgCollisionBox.cpp(325): error C2065: 'dir' : undeclared identifier
4>..\..\..\source\physics\dgCollisionBox.cpp(326): error C2440: 'return' : cannot convert from 'dgVector' to 'dgInt32'
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: Convex Stacks VS Box Stacks (3.12)

Postby Julio Jerez » Tue Jun 24, 2014 7:19 am

Code: Select all
dgVector dgCollisionBox::SupportVertex (const dgVector& dir, dgInt32* const vertexIndex) const
{
return dgCollisionConvex::SupportVertex (dir, vertexIndex);

   dgAssert (dir.m_w == dgFloat32 (0.0f));
   dgVector mask (dir < dgVector (dgFloat32 (0.0f)));
   return (m_size[1] & mask) + m_size[0].AndNot(mask);
}
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Convex Stacks VS Box Stacks (3.12)

Postby AntonSynytsia » Tue Jun 24, 2014 9:21 am

Ok, I got it all working, but the collisions behave exactly the same; boxes penetrate into each other unless I enable continuous collision. Enabling continuous collision makes it work like a charm. I don't have any problems with that anymore.

Thanks for the help anyway.
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: Convex Stacks VS Box Stacks (3.12)

Postby Julio Jerez » Thu Jul 03, 2014 1:00 pm

Ok I found out what he problem with this is and it Is fixed now
The contact penetration form convex was negative. that was a bug but it is fix now.
it should be the same whether you use Box or convex.

I think the images you show I think the title are transposed because the bug was with convex shapes not with boxes.

are you using the SVN version ot or you are using the last 3.12 update.
the last update is old, and I can no longer upload stable releases to Google source, I need to find out some place to upload stable release 3.13
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Convex Stacks VS Box Stacks (3.12)

Postby AntonSynytsia » Thu Jul 03, 2014 3:49 pm

Julio Jerez wrote:Ok I found out what he problem with this is and it Is fixed now
The contact penetration form convex was negative. that was a bug but it is fix now.
it should be the same whether you use Box or convex.

I think the images you show I think the title are transposed because the bug was with convex shapes not with boxes.

are you using the SVN version ot or you are using the last 3.12 update.
the last update is old, and I can no longer upload stable releases to Google source, I need to find out some place to upload stable release 3.13

Thank you for the fix, Juleo.

Yes, I use SVN. I check for update every other day. :twisted:

You may upload stable releases to Google Drive, and make them public, then the public link may be shared on this site, or/and on google code, so people know.
Google Drive (The free version) gives you 15GB of space on start :twisted: I'm certain that you'll be able to upload at least 10 stable releases since NewtonDynamics is like 1GB in size (uncompressed).

Another solution is DropBox...

Once, you upload 3.13, I will check it out.
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: Convex Stacks VS Box Stacks (3.12)

Postby AntonSynytsia » Thu Jul 03, 2014 6:35 pm

I tested 3.12 at revision 1640, and found that material thickness is negative now. Setting it to 1/32.0 will cause the objects to penetrate 1/32.0 units into other objects, while in original revision objects we're 1/32.0 units outside other objects.
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: Convex Stacks VS Box Stacks (3.12)

Postby Julio Jerez » Thu Jul 03, 2014 10:59 pm

Ha yes I have material thickness should be positive.
I will fix that.
Thanks for verifying it.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Convex Stacks VS Box Stacks (3.12)

Postby Julio Jerez » Fri Jul 04, 2014 2:43 pm

Ok I fix that bug now, svn 1644
collision should be fine for all shapes now.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Convex Stacks VS Box Stacks (3.12)

Postby AntonSynytsia » Fri Jul 04, 2014 4:57 pm

Thanks, Juleo.

Material thickness works properly now.
I can see that the buoyancy tutorial now works as well, thanks.

Though, the coefficients of restitution has stopped working at revision 1644.
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: Convex Stacks VS Box Stacks (3.12)

Postby Julio Jerez » Fri Jul 04, 2014 10:08 pm

AntonSynytsia wrote:Though, the coefficients of restitution has stopped working at revision 1644.

I will check that, thanks
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Next

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 9 guests

cron