Chamfer cylinder leaning on edge

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Chamfer cylinder leaning on edge

Postby Cannos » Thu May 04, 2017 7:36 pm

I'm seeing some odd behavior from chamfer cylinders. They can come to rest leaning back on their edge, instead of flat on the top or bottom. A similar convex hull does not show this behavior.

Here's a screenshot showing what I mean:
https://www.dropbox.com/s/eybe5yuyd0ium9r/chamferlean.jpg
chamferlean.jpg
chamferlean.jpg (239.57 KiB) Viewed 4639 times


I never saw this happen in Newton 2.x. I am currently using Newton 3.14 from 8/21/2016.

Any ideas on why this might happen and how I should test or fix this? Thanks.
Cannos
 
Posts: 129
Joined: Thu Mar 04, 2010 5:41 pm

Re: Chamfer cylinder leaning on edge

Postby Julio Jerez » Thu May 04, 2017 8:23 pm

I think that bug was fixed a while back. please sync to later and try again.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Chamfer cylinder leaning on edge

Postby Cannos » Fri May 05, 2017 1:13 pm

Do you have any ideas when that fix was made? If possible, I'd like to just patch the version of Newton I have with the fix, rather than getting the latest version. We're close to shipping our game and don't want to make a lot of changes to the otherwise stable version of Newton we have now. Thanks!
Cannos
 
Posts: 129
Joined: Thu Mar 04, 2010 5:41 pm

Re: Chamfer cylinder leaning on edge

Postby Julio Jerez » Fri May 05, 2017 1:18 pm

I can't find the exact version in GitHub by the file that made the fist was this.
Code: Select all
dgInt32 dgCollisionChamferCylinder::CalculatePlaneIntersection (const dgVector& normal, const dgVector& origin, dgVector* const contactsOut) const
{
   dgInt32 count = 0;
   const dgFloat32 inclination = dgFloat32 (0.9999f);
   if (normal.m_x < -inclination) {
      dgMatrix matrix(normal);
      dgFloat32 x = dgSqrt (dgMax (m_height * m_height - origin.m_x * origin.m_x, dgFloat32 (0.0f)));
      matrix.m_posit.m_x = origin.m_x;
      dgVector scale(m_radius + x);
      const int n = sizeof (m_unitCircle) / sizeof (m_unitCircle[0]);
      for (dgInt32 i = 0; i < n; i++) {
         contactsOut[i] = matrix.TransformVector(m_unitCircle[i].CompProduct4(scale)) & dgVector::m_triplexMask;
      }
      count = RectifyConvexSlice(n, normal, contactsOut);
   } else if (normal.m_x > inclination) {
.....


it was around Mars 20 this year.
you can probably made the change manually.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Chamfer cylinder leaning on edge

Postby Cannos » Fri May 05, 2017 5:10 pm

Excellent, it looks like that fixed it. Thanks Julio, you're a life saver!
Cannos
 
Posts: 129
Joined: Thu Mar 04, 2010 5:41 pm

Re: Chamfer cylinder leaning on edge

Postby Julio Jerez » Fri May 05, 2017 6:08 pm

I am curious what are you doing that required that shapes.
I made that shape specifically to be use as tires of any kind, but I never thought it would be use a regular shape.
That's why landing flat was never a priority, you are the second person who report using that shape, and I presume you are not using as a tire.

also after you guys release your product, would you let me know the title?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Chamfer cylinder leaning on edge

Postby Cannos » Fri May 05, 2017 7:33 pm

We're working on a sequel to our mobile game Disc Drivin', which you have on your Games using Newton page. In our game you slide discs around race tracks. The chamfer cylinder is the perfect shape to match our discs.

I briefly used disc-shaped convex hulls too, but it occasionally has some undersirable collisions trying to slide up ramps. The chamfer cylinders slide up ramps more smoothly. It's possible I could add more tris to my convex hull to smooth things out, but I haven't tried that since the chamfer cylinder worked so well for us in the past.

I'll definitely let you know when the new game releases.
Cannos
 
Posts: 129
Joined: Thu Mar 04, 2010 5:41 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 21 guests