A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by Lax » Wed Dec 10, 2025 4:12 pm
Hi Julio,
what happend to the NewtonBodySetJointRecursiveCollision function?
I need it, so that i can configure, that joints and its children do no collide with each other.
Best Regards
Lax
-
Lax
-
- Posts: 203
- Joined: Sat Jan 08, 2011 8:24 am
by Dave Gravel » Wed Dec 10, 2025 6:30 pm
Hi Lax, if I'm not mistaken, you can disable the collision either through the material with a flag comparison or by using joint->SetCollidable.
-

Dave Gravel
-
- Posts: 811
- Joined: Sat Apr 01, 2006 9:31 pm
- Location: Quebec in Canada.
-
by Lax » Thu Dec 11, 2025 6:42 am
Hi Dave,
thanks. Hm I could try joint->SetCollidable.
I hope that method affects, that joint is still collideable with other bodies in world.
I just want disable collision for root joint and its child joints and on the child joints each other.
Best Regards
Lax
-
Lax
-
- Posts: 203
- Joined: Sat Jan 08, 2011 8:24 am
by Dave Gravel » Thu Dec 11, 2025 8:25 am
In this case, I use the material flag. It requires a bit more code, but it works well.
- Code: Select all
class NoCollisionMaterial : public ndApplicationMaterial
{
public:
NoCollisionMaterial ()
:ndApplicationMaterial()
{
}
NoCollisionMaterial (const NoCollisionMaterial & src)
:ndApplicationMaterial(src)
{
}
ndApplicationMaterial* Clone() const
{
return new NoCollisionMaterial (*this);
}
virtual bool OnAabbOverlap(const ndBodyKinematic* const, const ndBodyKinematic* const) const override
{
// Avoid collision m_modelPart vs m_modelPart
return false;
}
};
// Global call
NoCollisionMaterial material;
material.m_restitution = 0.1f;
material.m_staticFriction0 = 1.25f;
material.m_staticFriction1 = 1.25f;
material.m_dynamicFriction0 = 1.25f;
material.m_dynamicFriction1 = 1.25f;
//
ndContactCallback* const callback = (ndContactCallback*)OX3D::m_context->m_newton->GetContactNotify();
callback->RegisterMaterial(material, ndDemoContactCallback::m_modelPart, ndDemoContactCallback::m_modelPart);
// Assign it to your bodies.
noCollMaterial = rob_ent->m_newton->GetShape().GetMaterial();
noCollMaterial.m_userId = ndDemoContactCallback::m_modelPart;
rob_ent->m_newton->GetBody()->GetCollisionShape().SetMaterial(noCollMaterial);
With OnAabbOverlap, you can also use different logic to detect whether a collision might occur or not.
-

Dave Gravel
-
- Posts: 811
- Joined: Sat Apr 01, 2006 9:31 pm
- Location: Quebec in Canada.
-
by Julio Jerez » Thu Dec 11, 2025 11:42 am
this function is deprecated NewtonBodySetJointRecursiveCollision.
there are two way you can emulate it.
-just like date said. you can use material flag.
basically, you can walk the hierarchy if connected bodies, and use one of the collision shaped materials to paint the bodies with the same unique color.
then in the contact callback you can check if that field in the material of the two colliding bodies colliding bodies are equal and different that the non-colliding value. if so, then return false.
that's just one way, but you can be creative with the materials.
you can check the material graph in the sdk demo and do something similar.
-another way that by using ndModel. there is a class ndModelArticulation
that allow you to build hierarchy of bodies and joints. this in this class all bodies disable collision by default.
but it is really easy to selectively get collision between pair because the ndNotification has a method for checking self Collison.
you can check the excavator demo. the excavator is a single model, so the part do not collide, when the link of the thread must collide with the cogs, so the collision method checks for those types and allow the contact joint to be generated.
-
Julio Jerez
- Moderator

-
- Posts: 12483
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 8 guests