@@ -64,7 +64,7 @@ void SceneCheckCollisionResponse::doCheckOn(Node* node)
6464 {
6565 if ( nbContactManager!= 1 )
6666 {
67- m_message << " Only one CollisionResponse is needed ." << msgendl;
67+ m_message << " Only one CollisionResponse is allowed in the scene ." << msgendl;
6868 }
6969 else
7070 {
@@ -101,6 +101,11 @@ void SceneCheckCollisionResponse::doCheckOn(Node* node)
101101 checkIfContactStiffnessIsSet (root);
102102 }
103103 }
104+ // / If PenalityContactForceField make sure that contactStiffness is defined
105+ else if ( response == " PenalityContactForceField" )
106+ {
107+ checkIfContactStiffnessIsNotSet (root);
108+ }
104109 }
105110 }
106111}
@@ -113,9 +118,24 @@ void SceneCheckCollisionResponse::checkIfContactStiffnessIsSet(const sofa::core:
113118 {
114119 if (model->isContactStiffnessSet ())
115120 {
116- m_message <<" The data \" contactStiffness\" is set in the component " << model->getClassName () <<" named " << model->getName () << msgendl ;
121+ m_message <<" The data \" contactStiffness\" is set in the component " << model->getClassName () <<" , named \" " << model->getName () << " \" " ;
117122 m_message <<" This data is not used when using a FrictionContactConstraint collision response." << msgendl;
118123 m_message <<" Remove the data \" contactStiffness\" to remove this warning" << msgendl;
124+ break ;
125+ }
126+ }
127+ }
128+
129+ void SceneCheckCollisionResponse::checkIfContactStiffnessIsNotSet (const sofa::core::objectmodel::BaseContext* root)
130+ {
131+ type::vector<core::CollisionModel*> colModels;
132+ root->get <core::CollisionModel>(&colModels, core::objectmodel::BaseContext::SearchDown);
133+ for (const auto model : colModels)
134+ {
135+ if (!model->isContactStiffnessSet ())
136+ {
137+ m_message <<" Using PenalityContactForceField, the contactStiffness should be defined for each CollisionModel" << msgendl;
138+ break ;
119139 }
120140 }
121141}
0 commit comments