Two bodies with initial collisions overlapping

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Two bodies with initial collisions overlapping

Postby misho » Sun Jan 06, 2019 4:43 pm

My scene has an assembly of bodies held by fixed hinges whose fitment is quite close, with tight tolerances. Sometimes, they have to be initially placed so that their collision volumes overlap. When in motion, I noticed these bodies "shaking" while still held together. This is because (and I'm guessing here) their collisions are "fighting" to repel from each other, while the hinge is trying to keep them together.

So, if I had a case where two bodies had to be placed and joined so that their collisions are initially overlapping - is there a way to control the amount of "repulsion" between the two bodies until they "exit" from each other? Or ultimately, is it possible to turn this repulsion off, and let them overlap until they are separated by external force?

IMHO, I think there should be a setting somewhere that controls this amount of "repulsion", and turns it completely off. I don't see any harm in initially having 2 bodies overlapping and not reacting to each other, if the user needs it to be that way.. :roll:
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am

Re: Two bodies with initial collisions overlapping

Postby JoeJ » Sun Jan 06, 2019 5:20 pm

IIRC, if there is a joint between two bodies, collisions get disabled automatically between its two bodies. Make sure they do collide indeed.

Otherwise you can set this behavior with NewtonJointSetCollisionState(), IIRC.

Also there are various contact callbacks where you could handle this if all of the above fails.
User avatar
JoeJ
 
Posts: 1453
Joined: Tue Dec 21, 2010 6:18 pm

Re: Two bodies with initial collisions overlapping

Postby Julio Jerez » Sun Jan 06, 2019 5:22 pm

not you can't turn repulsion from the engine off.
you need to make a contact call back an there assign collision flags to the collision shapes involved, then using Booleans operations to can reject the collision using this interface:
Code: Select all
NewtonCollisionMaterial material1;
NewtonCollisionGetMaterial(collision0, &material0);
NewtonCollisionSetMaterial(collision0, &material0);


to see how to set up, look at demo:
Code: Select all
../applications\demosSandbox\sdkDemos\demos\BasicFriction.cpp
static int UserOnAABBOverlap (const NewtonJoint* const contactJoint, dFloat timestep, int threadIndex)
static void UserContactFriction (const NewtonJoint* contactJoint, dFloat timestep, int threadIndex)


there are many more examples, by that's one of the easiest one
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Two bodies with initial collisions overlapping

Postby misho » Sun Jan 06, 2019 5:45 pm

Julio Jerez wrote:not you can't turn repulsion from the engine off.
you need to make a contact call back an there assign collision flags to the collision shapes involved, then using Booleans operations to can reject the collision using this interface:
Code: Select all
NewtonCollisionMaterial material1;
NewtonCollisionGetMaterial(collision0, &material0);
NewtonCollisionSetMaterial(collision0, &material0);


to see how to set up, look at demo:
Code: Select all
../applications\demosSandbox\sdkDemos\demos\BasicFriction.cpp
static int UserOnAABBOverlap (const NewtonJoint* const contactJoint, dFloat timestep, int threadIndex)
static void UserContactFriction (const NewtonJoint* contactJoint, dFloat timestep, int threadIndex)


there are many more examples, by that's one of the easiest one


Ok great - I'll check it out!
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho
 
Posts: 673
Joined: Tue May 04, 2010 10:13 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 13 guests